Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-09-23 20:12:04


Hi Ion,

Ion Gaztañaga <igaztanaga_at_[hidden]> wrote:
> If you compile:
>
> #include <boost/date_time/posix_time/posix_time_types.hpp>
> #include <boost/asio/asio.hpp>
>
> int main()
> {
> return 0;
> }
>
>
> You get a lot of socket redefinitions because date_time seems
> to be including winsock.h whereas asio uses winsock2.h.

Yep, date_time is including windows.h, which includes winsock.h.

> Is there any way to avoid these errors?

You can reverse the inclusion order to make it work. Defining
WIN32_LEAN_AND_MEAN will also prevent windows.h from including
winsock.h. The asio headers already include the following
construct to #define WIN32_LEAN_AND_MEAN:

# if !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
# if !defined(WIN32_LEAN_AND_MEAN)
# define WIN32_LEAN_AND_MEAN
# endif // !defined(WIN32_LEAN_AND_MEAN)
# endif // !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)

Perhaps something similar should be added to date_time, since
it does not need winsock.h?

Cheers,
Chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk