如何在 Visual Studio 2015 中更新我的 C++ 项目以使用新的通用 CRT?

2023-09-27C/C++开发问题
1

本文介绍了如何在 Visual Studio 2015 中更新我的 C++ 项目以使用新的通用 CRT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

VS2015 将我的项目更新到新的平台工具集 v140 后,由于链接器错误而无法构建:LNK1104 无法打开文件libucrt.lib".

After VS2015 updated my project to the new Platform toolset v140, it fails to build due to a linker error : LNK1104 cannot open file 'libucrt.lib'.

由于本文中提到的新通用 CRT,此库似乎已被移动:http://blogs.msdn.com/b/vcblog/archive/2015/03/03/introducing-the-universal-crt.aspx?PageIndex=2.

It appears this library has been moved around due to the new Universal CRT as mentioned in this article : http://blogs.msdn.com/b/vcblog/archive/2015/03/03/introducing-the-universal-crt.aspx?PageIndex=2.

虽然这篇文章确实告诉我我现在应该链接什么,但它没有提供如何链接的说明.

While the article does tell me what I should link towards now, it does not provide instructions how.

我的解决方案生成一个 .exe 和一个它使用的 .dll.我不知道如何处理文章下面描述的矩阵.

My Solution generates a .exe and a .dll it uses. I do not know what to do with the matrix the article describes below.

发布 DLL (/MD): msvcrt.lib vcruntime.lib ucrt.lib

Release DLLs (/MD ): msvcrt.lib vcruntime.lib ucrt.lib

发布静态(/MT):libcmt.lib libvcruntime.lib libucrt.lib

Release Static (/MT ): libcmt.lib libvcruntime.lib libucrt.lib

推荐答案

转换项目时,您需要确保更新包含和链接器设置以指向新的 CRT.

When you convert your project, you need to make sure you update both the includes AND the linker settings to point to the new CRT.

对于包含,添加以下内容:

For includes, add the following:

$(UniversalCRT_IncludePath)

对于链接,根据您的目标处理器添加以下内容之一:

For link, add one of the following depending on your target processor:

$(UniversalCRT_LibraryPath_x86)
$(UniversalCRT_LibraryPath_x64)
$(UniversalCRT_LibraryPath_arm)

这篇关于如何在 Visual Studio 2015 中更新我的 C++ 项目以使用新的通用 CRT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

无法访问 C++ std::set 中对象的非常量成员函数
Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)...
2024-08-14 C/C++开发问题
17

从 lambda 构造 std::function 参数
Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)...
2024-08-14 C/C++开发问题
25

STL BigInt 类实现
STL BigInt class implementation(STL BigInt 类实现)...
2024-08-14 C/C++开发问题
3

使用 std::atomic 和 std::condition_variable 同步不可靠
Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)...
2024-08-14 C/C++开发问题
17

在 STL 中将列表元素移动到末尾
Move list element to the end in STL(在 STL 中将列表元素移动到末尾)...
2024-08-14 C/C++开发问题
9

为什么禁止对存储在 STL 容器中的类重载 operator&()?
Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)...
2024-08-14 C/C++开发问题
6