[Boost-users] "WinSock.h has already been included" : problem with asio and VC++2010

4,107 views
Skip to first unread message

Claude

unread,
Jun 5, 2011, 7:42:17 AM6/5/11
to boost...@lists.boost.org

Hi!

I use a boost asio library in my program. When I compile with Visual C++
obtain this error:

[...]\boost_1_45_0\boost\asio\detail\socket_types.hpp(22): fatal error
C1189: #error : WinSock.h has already been included

How can I fix this error?


--
View this message in context: http://boost.2283326.n4.nabble.com/WinSock-h-has-already-been-included-problem-with-asio-and-VC-2010-tp3574900p3574900.html
Sent from the Boost - Users mailing list archive at Nabble.com.
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

michi7x7

unread,
Jun 5, 2011, 7:54:57 AM6/5/11
to boost...@lists.boost.org

> Hi!
Hello,

> I use a boost asio library in my program. When I compile with Visual C++
> obtain this error:
>
> [...]\boost_1_45_0\boost\asio\detail\socket_types.hpp(22): fatal error
> C1189: #error : WinSock.h has already been included
>
> How can I fix this error?

Try to include asio before including any other Windows-Headers, or use
WinSock2.h instead of WinSock.

Best Regards,

michi7x7

Hee-young Kim

unread,
Jun 5, 2011, 12:23:35 PM6/5/11
to boost...@lists.boost.org
If you use "Windows.h" library, set "#define WIN32_LEAN_AND_MEAN" in
"stdafx.h" or a suitable place to avoid the duplication.

from Hee-young


--
View this message in context: http://boost.2283326.n4.nabble.com/WinSock-h-has-already-been-included-problem-with-asio-and-VC-2010-tp3574900p3575268.html

Claude

unread,
Jun 6, 2011, 4:26:28 PM6/6/11
to boost...@lists.boost.org
Reply all
Reply to author
Forward
0 new messages