Linux – fatal error: sys/socket.h: No such file or directory, x86_64-w64-mingw32 mode

ccygwinlinuxmingw-w64sockets

I am trying to develop a program which depends on socket library, once i am trying to make it, it prompt me:

fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>

My build environment:
Windows 8.1 under Cygwin x64 version,
Build target: x86_64-w64-mingw32 as the –host=x86_64-w64-mingw32 parameters.

Command Line: cfalgs=-m64 ./configure –prefix=/usr/

I am building the app which is using the GTK+ 2.0.

I am trying to find the find under the socket.h file under the patch: cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\include\sys. It seems not exist at all.

So there is no x64 version MinGW socket lib??

Best Answer

sys/socket.h is a POSIX/SUS header. MinGW is for building WinAPI executables. Either switch to building with Cygwin's GCC to get access to POSIX/SUS facilities, or switch to using WinAPI's winsock2.h instead.

Related Topic