使用CygWin进行C套接字编程

你好

我正在尝试使用CygWin在C中编写一个小服务器/客户端程序,问题是,Cygwin中的
gcc编译器似乎不包含与套接字编程相关的标准头文件.在尝试编译我的服务器程序时,我得到:

netinet/in.h: No such file or directory
sys/socket.h: No such file or directory
netdb.h: No such file or directory

这三个标题是否位于CygWin-enviorment的其他位置?

最佳答案 尝试使用-I编译器命令行选项指定头文件的路径.

我的本地参考说明

-I dir
       Add the directory dir to the list of directories to be searched for
       header files.  Directories named by -I are searched before the
       standard system include directories.  If the directory dir is a
       standard system include directory, the option is ignored to ensure
       that the default search order for system directories and the
       special treatment of system headers are not defeated . 
点赞