在使用CodeBlocks編譯C++程序時,
編譯程序的時候出現如下錯誤:
undefined reference to `inet_addr@4'
undefined reference to `gethostbyname@4'
undefined reference to `WSAGetLastError@0'
undefined reference to `inet_ntoa@4'
undefined reference to `WSAStartup@8'
undefined reference to `inet_ntoa@4'
undefined reference to `socket@12'
undefined reference to `htons@4'
undefined reference to `bind@12'
undefined reference to `listen@8'
undefined reference to `accept@12'
undefined reference to `recv@16'
undefined reference to `send@16'
undefined reference to `shutdown@8'
undefined reference to `closesocket@4'
undefined reference to `closesocket@4'
undefined reference to `WSACleanup@0'
原因:缺少lib庫,編譯找不到相應的lib庫。
解決辦法:
1. 出現如下的情況
2. 設置編譯濃ky"http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vc8L3A+CjxwPiA8aW1nIHNyYz0="http://www.2cto.com/uploadfile/Collfiles/20140319/20140319092145316.jpg" alt="\">
3.
4. 導入相應的lib庫