linux - 无法使用 Cygwin 访问 sys/socket.h

标签 linux gcc g++ cygwin mingw

我需要在安装了 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/

相关文章:

java - 如何从 Java 为 sudo 提供 root 密码?

c - gcc 错误 : expected '=' , ',' 、 'ASM' 或 '__attribute__' 之前 'dequeue'

lxml 安装期间出现 python gcc 和 setuptools 错误

c++ - g++ 错误消息 "use ' this->equal' 相反?”

c++ - G++ 不清楚的编译失败

linux - cpu hotplug - 在 linux 中是否有禁用 cpu 的系统调用?

php - 使用 PHP Alternative 获取 Apache 版本

linux - 从 Ansible 在 Windows 上安装 IIS

c++ - 扩展内联汇编 : same variable for input and output

c++ - 在 Linux 上编程 C++ 时的非法指令