4

我正在尝试用 mingw32 for Linux编译它。

但是,我收到以下错误和警告:

# i586-mingw32msvc-gcc ms04-020.c -lws2_32 -o ms04-020.exe
ms04-020.c:43:22: error: Winsock2.h: No such file or directory
ms04-020.c: In function ‘main’:
ms04-020.c:113: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c:114:11: warning: unknown escape sequence '\;'
ms04-020.c: In function ‘readwrite’:
ms04-020.c:251: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c:259: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c:264: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c:279: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c:285: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c:290: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c:301: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c:307: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c:312: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c: In function ‘client_connect’:
ms04-020.c:333: warning: incompatible implicit declaration of built-in function ‘printf’
ms04-020.c:343: warning: incompatible implicit declaration of built-in function ‘printf’

我该如何解决有关的错误Winsock2.h?我确实设法在 Windows 7 上使用 Visual Studio 2013 进行编译,这将是一个可接受的解决方案,但是使用 Visual Studio 2010 或更高版本进行编译会使应用程序与 Windows 2000 目标操作系统不兼容。因此,即使它以这种方式构建,二进制文件也不会执行。

4

1 回答 1

7
于 2014-10-11T18:26:26.220 回答