DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  4737 随笔 :: 2 文章 :: 542 评论 :: 1615万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

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”
本文结束

posted on   DoubleLi  阅读(207)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源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)
点击右上角即可分享
微信分享提示