码迷,mamicode.com
首页 > 编程语言 > 详细

c++网络编程错误(WSAStartup)

时间:2015-08-19 22:53:53      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:

在使用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. 设置编译器 
  技术分享

3.  
技术分享


4. 导入相应的lib库 
技术分享

c++网络编程错误(WSAStartup)

标签:

原文地址:http://www.cnblogs.com/yuan951/p/4743222.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!