VS构建项目报错信息及解决办法04

5 篇文章 1 订阅
报错信息及解决7:

报错信息详情:error LNK2001: 无法解析的外部符号“symbol”

原因:编译后的代码引用或调用符号。 该符号未在链接器搜索的任何库或对象文件中定义。


什么是未解析的外部符号?

“符号”是函数或全局变量的内部名称。 它是在已编译的对象文件或库中使用或定义的名称形式。 全局变量在为其分配了存储的对象文件中进行定义。 函数在放置函数体的已编译代码的对象文件中进行定义。 “外部符号”是在一个对象文件中引用,但在不同的库或对象文件中定义的符号。 “导出的符号”是由定义它的对象文件或库公开提供的符号。 ​ 若要创建应用程序或 DLL,使用的每个符号都必须有一个定义。 链接器必须解析或查找每个对象文件引用的每个外部符号的匹配定义。 链接器在无法解析外部符号时生成错误。 这意味着链接器在任何链接文件中都找不到匹配的导出符号的定义。


解决办法:在cpp文件Include后添加 #pragma comment(lib,"XXXX.lib")

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
​
d3d11.lib
error LNK2019: 无法解析的外部符号 D3D11CreateDevice
​
winmm.lib
error LNK2019: 无法解析的外部符号 __imp_timeKillEvent
error LNK2019: 无法解析的外部符号 __imp_timeBeginPeriod
error LNK2019: 无法解析的外部符号 __imp_timeEndPeriod
error LNK2019: 无法解析的外部符号 __imp_timeSetEvent
error LNK2019: 无法解析的外部符号 __imp_timeGetTime
​
crypt32.lib
error LNK2019: 无法解析的外部符号 __imp_CertOpenStore
error LNK2019: 无法解析的外部符号 __imp_CertCloseStore
error LNK2019: 无法解析的外部符号 __imp_CertEnumCertificatesInStore
error LNK2019: 无法解析的外部符号 __imp_CertFindCertificateInStore
error LNK2019: 无法解析的外部符号 __imp_CertDuplicateCertificateContext
error LNK2019: 无法解析的外部符号 __imp_CertFreeCertificateContext
error LNK2019: 无法解析的外部符号 __imp_CertGetCertificateContextProperty
​
secur32.lib
error LNK2019: 无法解析的外部符号 InitializeSecurityContextA
error LNK2019: 无法解析的外部符号 AcquireCredentialsHandleA
error LNK2019: 无法解析的外部符号 __imp_FreeCredentialsHandle
error LNK2019: 无法解析的外部符号 CompleteAuthToken
error LNK2019: 无法解析的外部符号 __imp_DeleteSecurityContext
​
msdmo.lib
error LNK2019: 无法解析的外部符号 MoInitMediaType
error LNK2019: 无法解析的外部符号 MoFreeMediaType
​
wmcodecdspuuid.lib
error LNK2019: 无法解析的外部符号 CLSID_CWMAudioAEC
​
dmoguids.lib
error LNK2019: 无法解析的外部符号 IID_IMediaObject
error LNK2019: 无法解析的外部符号 IID_IMediaBuffer
​
strmiids.lib
error LNK2019: 无法解析的外部符号 IID_ICreateDevEnum
error LNK2019: 无法解析的外部符号 IID_IBaseFilter
error LNK2019: 无法解析的外部符号 IID_IAMExtDevice
error LNK2019: 无法解析的外部符号 IID_IAMStreamConfig
error LNK2019: 无法解析的外部符号 IID_IAMVideoControl
error LNK2019: 无法解析的外部符号 IID_IGraphBuilder
error LNK2019: 无法解析的外部符号 IID_IMemInputPin
error LNK2019: 无法解析的外部符号 IID_IPin
error LNK2019: 无法解析的外部符号 IID_IMemAllocator
error LNK2019: 无法解析的外部符号 IID_IEnumMediaTypes
error LNK2019: 无法解析的外部符号 IID_IEnumPins
​
advapi32.lib
error LNK2019: 无法解析的外部符号 __imp_RegQueryValueExW
error LNK2019: 无法解析的外部符号 __imp_RegCloseKey
error LNK2019: 无法解析的外部符号 __imp_RegOpenKeyExW
error LNK2019: 无法解析的外部符号 __imp_DeregisterEventSource
error LNK2019: 无法解析的外部符号 __imp_RegisterEventSourceW
error LNK2019: 无法解析的外部符号 __imp_ReportEventW
error LNK2019: 无法解析的外部符号 __imp_CryptAcquireContextW
error LNK2019: 无法解析的外部符号 __imp_CryptReleaseContext
error LNK2019: 无法解析的外部符号 __imp_CryptDestroyKey
error LNK2019: 无法解析的外部符号 __imp_CryptSetHashParam
error LNK2019: 无法解析的外部符号 __imp_CryptGetProvParam
error LNK2019: 无法解析的外部符号 __imp_CryptGetUserKey
error LNK2019: 无法解析的外部符号 __imp_CryptExportKey
error LNK2019: 无法解析的外部符号 __imp_CryptDecrypt
error LNK2019: 无法解析的外部符号 __imp_CryptCreateHash
error LNK2019: 无法解析的外部符号 __imp_CryptDestroyHash
error LNK2019: 无法解析的外部符号 __imp_CryptSignHashW
error LNK2019: 无法解析的外部符号 __imp_CryptEnumProvidersW
​
gdi32.lib
error LNK2019: 无法解析的外部符号 __imp_CreateRectRgn
error LNK2019: 无法解析的外部符号 __imp_GetRgnBox
error LNK2019: 无法解析的外部符号 __imp_DeleteObject
error LNK2001: 无法解析的外部符号 __imp_DeleteObject
error LNK2019: 无法解析的外部符号 __imp_GetCurrentObject
error LNK2019: 无法解析的外部符号 __imp_GetObjectW
error LNK2019: 无法解析的外部符号 __imp_CreateCompatibleDC
error LNK2001: 无法解析的外部符号 __imp_CreateCompatibleDC
error LNK2019: 无法解析的外部符号 __imp_SelectObject
error LNK2001: 无法解析的外部符号 __imp_SelectObject
error LNK2019: 无法解析的外部符号 __imp_BitBlt
error LNK2001: 无法解析的外部符号 __imp_BitBlt
error LNK2019: 无法解析的外部符号 __imp_DeleteDC
error LNK2001: 无法解析的外部符号 __imp_DeleteDC
error LNK2019: 无法解析的外部符号 __imp_GetDeviceCaps
error LNK2001: 无法解析的外部符号 __imp_GetDeviceCaps
error LNK2001: 无法解析的外部符号 __imp_GetDeviceCaps
error LNK2019: 无法解析的外部符号 __imp_CreateDIBSection

eg:

 

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

What’smean

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值