解决boost::asio的WinSock.h has already been included
来源:互联网 发布:约翰霍普金斯大学 知乎 编辑:程序博客网 时间:2024/05/21 06:30
本文转自:http://blog.csdn.net/gzlyb/archive/2010/09/08/5870326.aspx
用如下第一条搞定:
开始使用boost::asio库时,编译碰到这个错误提示:
fatal error C1189: #error : WinSock.h has already been included
查了下抛出这个错误的boost代码,原来是定义了_WINSOCKAPI_,但没有定义_WINSOCK2API_
那哪里定义了_WINSOCKAPI_呢?
后来在网上查了下,原来是我包含了Windows.h头文件,而Windows.h头文件又包含了WinSock.h这个老东西
知道原因就简单了,试了下,方法有三种可解决此错误:
1、在包含Windows.h前定义宏WIN32_LEAN_AND_MEAN,就OK了(WIN32_LEAN_AND_MEAN表示不包含一些极少使用和偏门的资料)
2、在包含Windows.h前包含winsock2.h
3、在包含Windows.h前包含asio.hpp
- 解决boost::asio的WinSock.h has already been included
- 解决boost::asio的WinSock.h has already been included
- 解决boost::asio的WinSock.h has already been included
- 解决boost::asio的WinSock.h has already been included
- 解决boost::asio的WinSock.h has already been included
- 解决boost::asio的WinSock.h has already been included
- 解决boost::asio的WinSock.h has already been included
- 解决boost::asio的WinSock.h has already been included
- boost asio中 error C1189: #error : WinSock.h has already been included 的问题
- boost asio中 error C1189: #error : WinSock.h has already been included 的问题
- boost\asio fatal error C1189: #error : WinSock.h has already been included错误处理
- QT与boost asio共存WinSock.h has already been included问题
- WinSock.h has already been included
- fatal error C1189: #error : WinSock.h has already been included
- 解决error : WINDOWS.H already included
- 解决#error : WINDOWS.H already included.
- JSP文件下载及getOutputStream() has already been的解决
- JSP文件下载及getOutputStream() has already been的解决
- SQLite3 写数据库时的锁机制
- C++和Java中关于继承的点点滴滴
- ExtJs——ComboBox(下拉列表、从后台读取数据、带分页)!!!
- Memcached 集群架构问题归纳
- Molehill 3D APIs - GPU硬件加速的Flash 3D API
- 解决boost::asio的WinSock.h has already been included
- Swiped VS Non-Swiped Transactions
- Net framework2.0 3.5 无法安装,附解决方法
- [抢鲜翻译]Adobe实验室新品:支持3D硬件加速以及立方贝赛尔曲线绘制的预览版运行时——Incubator
- StringGrid操作大全
- makefile解释及模板
- sqlserver2005安装程序无法获取aspnet账户的系统账户信息
- Java Socket 2
- 面试题:敲七