报错信息如下:
undefined reference to __imp_getaddrinfo' undefined reference to
__imp_WSASocketW’
undefined reference to __imp_socket' undefined reference to
__imp_setsockopt’
undefined reference to __imp_setsockopt' undefined reference to
__imp_freeaddrinfo’
undefined reference to `__imp_freeaddrinfo’
解决方案:
根据实际情况在cmakelists.txt
中添加如下语句
target_link_libraries(project_name PUBLIC ws2_32)