Include winsock headers and link winsock through a pragma comment
#ifdef _WIN32 # include <WinSock2.h> # include <Ws2tcpip.h> # pragma comment(lib, "Ws2_32.lib") #else // Do something else here for non windows #endif