linux中的socket头是哪里的

nXq*_*Xqd 7 c++ linux

I compile my simple prog with #include <sys/socket.h> but there's none of this file. Where is it, I just start coding in linux and I have no idea where is it . Or do we need to download it online .

Pet*_* G. 19

如果您已安装手册页,则第一站应该是man socket.

没有手册页,你可以打电话

find /usr/include -name socket.h
Run Code Online (Sandbox Code Playgroud)

哪个输出

/usr/include/asm/socket.h
/usr/include/sys/socket.h
/usr/include/bits/socket.h
/usr/include/linux/socket.h
Run Code Online (Sandbox Code Playgroud)

在我的系统上,要包含的是sys/socket.h.

另请参阅Single UNIX Specification.