我只是尝试使用 MinGW 在 MSYS 中构建 netcat,并意识到 MinGW 从未真正将所有 BSD 套接字内容移植到 Windows(例如 sys/socket.h)。我知道你可以在 MinGW 中使用 Windows 套接字,但为什么他们从来没有为 BSD 套接字创建 Windows 端口?我注意到很多程序使用#ifdef 来解决这个问题。是否有可以替代使用的 BSD 套接字的 Windows 端口?
以下是在 MSYS 中对 netcat 进行 make 时的错误:
gcc -DLOCALEDIR=\"\/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -Wall -c `test -f 'core.c' || echo './'`core.c
In file included from core.c:29:
netcat.h:38:24: sys/socket.h: No such file or directory
netcat.h:39:63: sys/uio.h: No such file or directory
netcat.h:41:24: netinet/in.h: No such file or directory
netcat.h:42:55: arpa/inet.h: No such file or directory
MinGW 没有#ifdef。是否有一个库/包我可以添加到 MSYS 以使所有内容都可以无错误地编译?