MinGW linker error: winsock

前端 未结 4 1982
暗喜
暗喜 2020-11-28 05:50

I am using MinGW compiler on Windows to compile my C++ application with sockets. My command for linking looks like:

g++.exe -Wall -Wno-long-long -pedantic -l         


        
4条回答
  •  旧时难觅i
    2020-11-28 06:10

    Put the -lws2_32 AFTER the list of object files - GCC searches libraries and object files in the order they appear on the command line.

    Just to help the other viewers out there:

    gcc hello.c -o hello.o -lws2_32
    

提交回复
热议问题