VS 2010 express - 标识符“fd_set”未定义

问题描述:

我在Visual Studio 2010 for Windows中编程。VS 2010 express - 标识符“fd_set”未定义

我不明白为什么它不承认类型fd_set

我是否缺少头文件?

根据MS文档,fd_set结构在Winsock2.h中定义。看到这里:http://msdn.microsoft.com/es-es/library/windows/desktop/ms737873%28v=vs.85%29.aspx

+0

谢谢,我在我的项目中添加#include“winsock2.h”,但在winsock2.h中有很多错误。 例如: 错误C4430:缺少类型说明符 - 假定为int。注意:C++不支持默认int \t 错误错误C2556: 'INT(__cdecl * DECLARE_STDCALL_P(protoent *))(常量字符*)':重载函数仅通过返回类型从“诠释不同(__cdecl * DECLARE_STDCALL_P(protoent *))(int)' – user2200912 2013-03-22 21:46:22

+1

我解决了!没有找到winsock2.h,但在winsock.h中找到并添加了WS2_32.lib 非常感谢 – user2200912 2013-03-22 22:04:06