LNK2019:常见缺的两个系统库文件

在开发过程中遇到了一系列与ws2_32.lib、winmm.lib和gdi32.lib相关的链接错误,如无法解析的外部符号。这些问题通常涉及到WindowsAPI函数未正确链接。解决方案可能包括确保正确包含库文件,设置链接器选项,或者在源代码中正确声明和实现这些函数。

ws2_32.lib

error LNK2001: 无法解析的外部符号 __imp_htons

error LNK2001: 无法解析的外部符号 __imp_ntohl

error LNK2001: 无法解析的外部符号 __imp_ntohs

error LNK2019: 无法解析的外部符号 in6addr_any

error LNK2001: 无法解析的外部符号 __imp_htonl

error LNK2019: 无法解析的外部符号 in6addr_loopback

winmm.lib

error LNK2019: 无法解析的外部符号 __imp_timeKillEvent

error LNK2019: 无法解析的外部符号 __imp_timeBeginPeriod

error LNK2019: 无法解析的外部符号 __imp_timeEndPeriod

error LNK2019: 无法解析的外部符号 __imp_timeSetEvent

error LNK2019: 无法解析的外部符号 __imp_timeGetTime

gdi32.lib

error LNK2019: 无法解析的外部符号 __imp_CreateRectRgn

error LNK2019: 无法解析的外部符号 __imp_GetRgnBox

error LNK2019: 无法解析的外部符号 __imp_DeleteObject

1>LINK : warning LNK4098: 默认库“LIBCMT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library 1>UsrAcqDrv.obj : error LNK2019: 无法解析的外部符号 _invalid_parameter,函数 "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z) 中引用了该符号 1>libcpmtd.lib(xtime.obj) : error LNK2001: 无法解析的外部符号 _invalid_parameter 1>libcpmtd.lib(thread0.obj) : error LNK2001: 无法解析的外部符号 _invalid_parameter 1>UsrAcqDrv.obj : error LNK2019: 无法解析的外部符号 _CrtDbgReport,函数 "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z) 中引用了该符号 1>libcpmtd.lib(xtime.obj) : error LNK2001: 无法解析的外部符号 _CrtDbgReport 1>libcpmtd.lib(thread0.obj) : error LNK2001: 无法解析的外部符号 _CrtDbgReport 1>UsrAcqDrv.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: bool __cdecl std::less<int>::operator()(int const &,int const &)const " (__imp_??R?$less@H@std@@QEBA_NAEBH0@Z),函数 "bool __cdecl std::_Debug_lt_pred<struct std::less<int> const &,int const &,int const &,0>(struct std::less<int> const &,int const &,int const &)" (??$_Debug_lt_pred@AEBU?$less@H@std@@AEBHAEBH$0A@@std@@YA_NAEBU?$less@H@0@AEBH1@Z) 中引用了该符号 1>libcpmtd.lib(mutex.obj) : error LNK2019: 无法解析的外部符号 _calloc_dbg,函数 _Mtx_init 中引用了该符号 1>libcpmtd.lib(cond.obj) : error LNK2001: 无法解析的外部符号 _calloc_dbg 1>libcpmtd.lib(mutex.obj) : error LNK2019: 无法解析的外部符号 _free_dbg,函数 _Mtx_destroy 中引用了该符号 1>libcpmtd.lib(cond.obj) : error LNK2001: 无法解析的外部符号 _free_dbg 1>x64\Debug_v80\UsrAcqDrv.dll : fatal error LNK1120: 5 个无法解析的外部命令 1>已完成生成项目“UsrAcqDrv.vcxproj”的操作 - 失败。
最新发布
11-13
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值