Discussion:
boost::asio Visual Studio 8 - fatal error C1189: #error : WinSock.h has already been included
Julian Cain
2008-03-18 22:17:55 UTC
Permalink
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?

thanks

jc
Julian Cain
2008-03-18 22:22:48 UTC
Permalink
Sorry, that would be VS 9.0 (2008)
Post by Julian Cain
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?
thanks
jc
_______________________________________________
Boost-users mailing list
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boris
2008-03-18 23:18:36 UTC
Permalink
Post by Julian Cain
Sorry, that would be VS 9.0 (2008)
Post by Julian Cain
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?
No problem here with VC++ 2008 and Boost.Asio 0.3.9.

Boris
Andrey Tcherepanov
2008-03-19 02:51:56 UTC
Permalink
Julian,

you might want to

#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */

before including any headers in your file. This way only winsock2.h will
be included. Or, alternatively, you can try to include winsock2.h yourself
before anything.

Have fun
Andrey.
Post by Julian Cain
Sorry, that would be VS 9.0 (2008)
Post by Julian Cain
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?
thanks
jc
Darren Garvey
2008-03-21 00:13:07 UTC
Permalink
Hi Julian,
Post by Julian Cain
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

Loading...