n1mda@royal:~/programming/c/n1tr$ i586-mingw32msvc-gcc -lws2_32 -o client client.c /tmp/ccyeduiN.o:client.c:(.text+0x4a): undefined reference to `_WSAStartup@8' /tmp/ccyeduiN.o:client.c:(.text+0x65): undefined reference to `_gethostbyname@4' /tmp/ccyeduiN.o:client.c:(.text+0x79): undefined reference to `_socket@12' /tmp/ccyeduiN.o:client.c:(.text+0xa5): undefined reference to `_htons@4' /tmp/ccyeduiN.o:client.c:(.text+0xbe): undefined reference to `_inet_ntoa@4' /tmp/ccyeduiN.o:client.c:(.text+0xc4): undefined reference to `_inet_addr@4' /tmp/ccyeduiN.o:client.c:(.text+0xf4): undefined reference to `_connect@12' collect2: ld returned 1 exit status //#include #include //#include #pragma comment(lib,"wsock32.lib") EDIT: Solution: i586-mingw32msvc-gcc -o client client.c -lws2_32 The library flag must come AFTER source input