关于error LNK2001: unresolved external symbol __imp__gethostbyaddr@12

本文解决了一个关于WSAChat项目的编译链接错误问题,主要错误为未解析的外部符号,涉及WSACleanup、WSAStartup等函数。通过在项目设置中添加ws2_32.lib库文件解决了该问题。

问题描述:

Deleting intermediate files and output files for project 'WSAChat - Win32 Debug'.
--------------------Configuration: WSAChat - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
WSAChat.cpp
WSAChatDlg.cpp
Generating Code...
Linking...
LINK : warning LNK4075: ignoring /INCREMENTAL due to /FORCE specification
WSAChat.obj : error LNK2001: unresolved external symbol __imp__WSACleanup@0
WSAChat.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__closesocket@4
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__WSAAsyncSelect@16
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__bind@12
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__htons@4
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__htonl@4
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__WSASocketA@24
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__gethostbyaddr@12
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__WSARecvFrom@36
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__WSASendTo@36
WSAChatDlg.obj : error LNK2001: unresolved external symbol __imp__gethostbyname@4
Debug/WSAChat.exe : warning LNK4088: image being generated due to /FORCE option; image may not run
Creating browse info file...

WSAChat.exe - 12 error(s), 2 warning(s)

 

解决方法:Project->Settings->Link->Object/libary modules:加上ws2_32.lib

 

转载于:https://www.cnblogs.com/enterBeijingThreetimes/archive/2008/11/22/1339113.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值