MingW/codeblocks下 WSAStartup@8报错的解决办法

socket编程时出现如下的error:

||=== 生成: Debug in ccc (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `Z10ThreadprocPv@4':|
D:\code\ccc\main.cpp|16|undefined reference to `recv@16'|
obj\Debug\main.o||In function `main':|
D:\code\ccc\main.cpp|28|undefined reference to `WSAStartup@8'|
D:\code\ccc\main.cpp|30|undefined reference to `socket@12'|
D:\code\ccc\main.cpp|33|undefined reference to `WSAGetLastError@0'|
D:\code\ccc\main.cpp|40|undefined reference to `inet_addr@4'|
D:\code\ccc\main.cpp|41|undefined reference to `htons@4'|
D:\code\ccc\main.cpp|43|undefined reference to `bind@12'|
D:\code\ccc\main.cpp|49|undefined reference to `listen@8'|
D:\code\ccc\main.cpp|56|undefined reference to `accept@12'|
D:\code\ccc\main.cpp|62|undefined reference to `htons@4'|
D:\code\ccc\main.cpp|62|undefined reference to `inet_ntoa@4'|
||=== Build 失败了: 11 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


解决办法:把libws2_32.a加到链接器中


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值