I am using Clion, which uses MinGW and Cmake. When I try to use the standalone asio
library I am getting
undefined reference to `WSAStartup@8'
undefined reference to `WSASetLastError@4'
undefined reference to `closesocket@4'
...
I believe I have to link the C:/Windows/System32/ws2_32.dll
library. I tried adding something like -L C:/Windows/System32 -lws2_32
:
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS} -static -lws2_32")
But that didn't help. How can I fix these errors ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…