现象
在这样的情况下,
#include <Windows.h>
#include <boost/asio.hpp>
编译器会报错,fatal error C1189: #error : WinSock.h has already been included
解决办法
#define WIN32_LEAN_AND_MEAN // 在#include<windows.h>前定义
#include <windows.h>
本文介绍了一个在使用Boost.Asio和Windows.h时遇到的编译错误:WinSock.h已经被包含的问题。通过预定义宏WIN32_LEAN_AND_MEAN可以有效避免此冲突。
1249

被折叠的 条评论
为什么被折叠?