Gmane
From: Christopher Kohlhoff <chris <at> kohlhoff.com>
Subject: Re: [date_time][asio] Compilation errors due to winsock includes
Newsgroups: gmane.comp.lib.boost.devel
Date: 2006-09-24 00:12:04 GMT (2 years, 40 weeks, 3 days, 18 hours and 33 minutes ago)
Hi Ion,

Ion GaztaƱaga <igaztanaga <at> gmail.com> 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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost