colorful

zc qq:1337220912

 

wxWidgets+boost::asio "socket_types.hpp(22) : fatal error C1189: #error : WinSock.h has already been included"

http://blog.csdn.net/gzlyb/article/details/5870326

因为wxWidgets 里已经include "Winsock.h"
在网上找了解决方法:
http://boost.2283326.n4.nabble.com/quot-WinSock-h-has-already-been-included-quot-problem-with-asio-and-VC-2010-td3574900.html
两种方法都可行

"WinSock.h has already been included" : problem with asio and VC++2010

Claude

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?


Reply | Threaded |   star

Re: "WinSock.h has already been included" : problem with asio and VC++2010

michi7x7-2

> 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

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded |   star

Re: "WinSock.h has already been included" : problem with asio and VC++2010

Hee-young Kim
In reply to this post by Claude
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
Reply | Threaded |   star

Re: "WinSock.h has already been included" : problem with asio and VC++2010

Claude
I solved the problem, thanks!

posted on 2012-04-05 13:25 多彩人生 阅读(2595) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

统计

常用链接

留言簿(3)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜