VS2019开发一个项目,报错:如下,
error LNK2001: unresolved external symbol __imp___CrtDbgReport
error LNK2001: unresolved external symbol __imp___invalid_parameter
error LNK2001: unresolved external symbol __imp___CrtDbgReportW
error LNK2001: unresolved external symbol __imp___CrtDbgReportW
error LNK2001: unresolved external symbol __imp___CrtDbgReportW
error LNK2001: unresolved external symbol __imp___free_dbg
error LNK2001: unresolved external symbol __imp___malloc_dbg
对应的中文版报错如下,
严重性 代码 说明 项目 路径 文件 行 禁止显示状态
错误 LNK2019 无法解析的外部符号 __imp__invalid_parameter,
错误 LNK2019 无法解析的外部符号 __imp__calloc_dbg,
错误 LNK2019 无法解析的外部符号 __imp__CrtDbgReport,
错误 LNK2019 无法解析的外部符号 __imp__free_dbg,
错误 LNK2019 无法解析的外部符号 __imp__malloc_dbg,
错误 LNK1120 5 个无法解析的外部命令
看名称,应该是某个库找不到,但到底是哪个库呢?能过搜索后发现,是ucrtd.lib这个库。
具体可能考:
Visual Studio Feedback
Developer community 2
https://developercommunity.visualstudio.com/t/5-unresolved-external-symbols-when-linking-vc-proj/593359
其中有一段是这么说的,
The upgraded project is missing a reference to the Universal CRT, specifically ucrtd.lib. This library comes from the Windows 10 SDK and is part of the VS 2015/Windows 10 change which brings portions of the C-runtime into the OS. Details on this change and other potential issues you may find upgrading to VS 2015 and later can be found here:
Microsoft C++ porting and upgrading guide | Microsoft Docs
And the specific page related to the Universal CRT:
Upgrade your code to the Universal CRT | Microsoft Docs
From what I can tell, the following changes are needed to the supplied repro projects to resolve the link errors:
Add $(UniversalCRT_LibraryPath_x86) to Linker->General->“Additional Library Directories”
Add ucrtd.lib to Linker->Input->“Additional Dependencies”
本文结束
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
2018-08-02 jsoncpp 构造空数组
2017-08-02 高效线程池之无锁化实现(Linux C)
2017-08-02 fdkaac的编译方法
2015-08-02 uboot里读sd卡内容
2015-08-02 uboot从SD卡烧写内核和文件系统
2015-08-02 用SD卡下载uboot、linux内核和文件系统
2015-08-02 在Linux运行期间升级Linux系统(Uboot+kernel+Rootfs)