我需要在安装了 MicGW GCC 和 G++ 4.7 的 Windows 8 中编译 C/C++ pthread 和套接字代码。
当我使用 g++ test.cpp -o test
代码是:
#include<iostream>
#include<sys/socket.h>
#include<sys/types.h>
using namespace std;
int main() {
cout<<"Got Socket";
}
这会给出错误 fatal error :sys/socket.h not found
并且
types.h
我发现的错误是 cygwin 正在使用 MicGW GCC 和 g++,但我希望它使用自己的而不是 MinGW 的,以便我可以包含 Linux 库。
最佳答案
我无法在我的 Cygwin 上重现您的问题。
header 是否存在于/usr/include/sys 中?
关于linux - 无法使用 Cygwin 访问 sys/socket.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15326663/