undefined reference to `__imp_socket'

undefined reference to `__imp_WSAStartup'
E:/CLion_code/c_multi_v2_server/main.c:11: undefined reference to `__imp_socket'
E:/CLion_code/c_multi_v2_server/main.c:14: undefined reference to `__imp_setsockopt'
E:/CLion_code/c_multi_v2_server/main.c:17: undefined reference to `__imp_inet_addr'
E:/CLion_code/c_multi_v2_server/main.c:19: undefined reference to `__imp_htons'
E:/CLion_code/c_multi_v2_server/main.c:26: undefined reference to `__imp_sendto'

 

解决办法:

link_libraries(-lIphlpapi)//链接这个库
posted @ 2020-07-14 16:48  MoonXu  阅读(5956)  评论(0编辑  收藏  举报