WinSock2.h编译错误

时间:2015-10-23 16:08:36

标签: c++ windows-server-2003 visual-studio-2003

我正在尝试使用Visual Studio 2003运行一个项目。但是我收到了很多类似于以下内容的编译错误。

错误指向WinSock2.h文件。我正在从WinSock2.h文件中复制几段代码片段和相应的错误

typedef struct fd_set {
    u_int fd_count;               /* how many are SET? */
    SOCKET  fd_array[FD_SETSIZE];   /* an array of SOCKETs */
} fd_set;
  

C:\ Program Files \ Microsoft Visual Studio .NET   2003 \ Vc7 \ PlatformSDK \ Include \ WinSock2.h(114):错误C2065:' fd_set' :   未声明的标识符

struct sockaddr {
    u_short sa_family;              /* address family */
    char    sa_data[14];            /* up to 14 bytes of direct address */
};
  

C:\ Program Files \ Microsoft Visual Studio .NET   2003 \ Vc7 \ PlatformSDK \ Include \ WinSock2.h(109):错误C2143:语法   错误:缺少';'之前' {'

将ws2_32.lib文件添加到"配置属性 - 链接器 - 输入 - 附加依赖关系"。构建配置平台是win32。

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

可以找到具有良好头文件顺序的典型基本Winsock应用程序here

Non-resolvable parent POM for com.simpligility.android.sdk-deployer:maven-android-sdk-deployer:2.8.0: 
Failure to find com.simpligility.maven:progressive-organization-pom:pom:3.3.3 
in https://repo.maven.apache.org/maven2 was cached in the local repository, 

包含头文件的顺序很重要

相关问题