报错信息及解决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: