(.text+0x100): undefined reference to `__imp_getaddrinfo'

官方文檔:

https://docs.microsoft.com/zh-cn/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo?redirectedfrom=MSDN

Windows Socket編程時,在創建 Socket 時出現問題:

Server.cpp:(.text+0x100): undefined reference to `__imp_getaddrinfo'  如下所示:

解決方法:

選擇 Tools ->  Compiler Options -> General -> Add the following commands when calling the compiler:  中添加

-lws2_32 

重新編譯即可。

注: 兩條命令之間用一個英文空格隔開。

 

參考:

https://stackoverflow.com/questions/21022654/undefined-reference-to-imp-getaddrinfo

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章