在socket编程的过程中头文件中
#include <windows.h> #include "stdafx.h" #include "WinSock2.h"
在编译的时候会报错 :error C2011: 'fd_set' : 'struct' type redefinition
解决方法
在所有的#include <windows.h>前使用#define WIN32_LEAN_AND_MEAN,如:


这样编译就成功了。原因还不清楚。
在socket编程的过程中头文件中
#include <windows.h> #include "stdafx.h" #include "WinSock2.h"
在编译的时候会报错 :error C2011: 'fd_set' : 'struct' type redefinition
解决方法
在所有的#include <windows.h>前使用#define WIN32_LEAN_AND_MEAN,如:
这样编译就成功了。原因还不清楚。
转载于:https://www.cnblogs.com/logy/p/3344134.html