When compiling with MinGW, link with ws2_32.