Boost logo

Boost Users :

From: Alexander Pensky (Alex_at_[hidden])
Date: 2008-03-21 08:48:14


> ---------- Forwarded message ----------
> From: "Darren Garvey" <darren.garvey_at_[hidden]>
> To: boost-users_at_[hidden]
> Date: Fri, 21 Mar 2008 00:13:07 +0000
> Subject: Re: [Boost-users] boost::asio Visual Studio 8 - fatal error C1189: #error : WinSock.h has already been included
> Hi Julian,
>
>
> On 18/03/2008, Julian Cain <jolix_at_[hidden]> wrote:
> > I have upgraded to VS 8.0 Standard and when compiling ASIO errors on the following:
> >
> > 1>Unknown compiler version - please run the configure tests and report the results
> > 1>C:\tor\trunk\lib\boost\boost/asio/detail/socket_types.hpp(27) : fatal error C1189: #error : WinSock.h has already been included
> >
> > Is this a known problem?
>
>
> What do you mean by 'compiling asio'? It is a header-only library. :)
>
> The problem you're seeing is because the (old) winsock.h header has been included. Most people that see this do because they've included windows.h *before* the asio headers.
>
> You can get around this by defining WIN32_LEAN_AND_MEAN (something like that) before including windows.h, or just by including windows.h after everything else.
>
> Regards,
> Darren
>
I've noticed the same behavior. I understand there's a workaround,
but in my opinion it's still a bug. asio.hpp has a requirement that
it must be #included "early enough" or else it won't compile. That's
not a well-behaved header, and it's not "boost-y". Other boost
components can be #included much later than <windows.h> and they will
go through the whole boost/config process and re-including windows.h
or winsock.h with no problems.

- Alex


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net