本文主要是介绍一点点解决链接错误的经验,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
链接时报错如下
[build] ***.obj ***: undefined reference to `WspiapiGetNameInfo'
[build] ***.obj ***: undefined reference to `gai_strerrorA'
[build] ***.obj ***: undefined reference to `WspiapiFreeAddrInfo'
[build] ***.obj ***: undefined reference to `WspiapiGetAddrInfo'
[build] ***.obj ***: undefined reference to `gai_strerrorA'
[build] ***.obj ***: undefined reference to `__imp_WSACleanup'
[build] ***.obj ***: undefined reference to `__imp_WSASetLastError'
[build] ***.obj ***: undefined reference to `__imp_WSASetLastError'
[build] ***.obj ***: undefined reference to `__imp_WSASetLastError'
[build] ***.obj ***: undefined reference to `__imp_WSASetLastError'
[build] ***.obj ***: undefined reference to `__imp_shutdown'
解决方法很简单,拿着其中一个看着顺眼的函数,例如 WspiapiGetNameInfo
,或者下面的去掉imp例如WSACleanup
,搜索函数名 MSDN
,如图:
点进去翻到最下面
需要链接ws2_32
,搞定
这篇关于一点点解决链接错误的经验的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!