C++ 找不到 Visual Studio Platform 2015 工具集 ='v141'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43312676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 15:33:18  来源:igfitidea点击:

Visual Studio Platform 2015 Toolset ='v141' cannot be found

c++visual-studio-2015openframeworks

提问by cy_b0rg

I'm trying to compile a project using OpenFrameworks (a library which uses C++) in Visual Studio. The build is set to Release and X64 and in the project properties I have set the Platform Toolset to Visual Studio 2015 (v140)

我正在尝试在 Visual Studio 中使用 OpenFrameworks(一个使用 C++ 的库)编译一个项目。构建设置为 Release 和 X64,在项目属性中,我将平台工具集设置为 Visual Studio 2015 (v140)

However every time I try to build the project I get the same error (amongst others)

但是,每次我尝试构建项目时,都会遇到相同的错误(等等)

Error MSB8020 The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools.

错误 MSB8020 找不到 v141 的构建工具(平台工具集 = 'v141')。要使用 v141 构建工具进行构建,请安装 v141 构建工具。

I know v141 is from the new version of MSVS 2017 but I do not want to upgrade to as the new version is not compatible with OpenFrameworks. I have tried rebuilding the project from scratch several times and have also looked into the VCXPROJ file and verified that everything is set to V140 - and it is. All very bizarre.

我知道 v141 来自 MSVS 2017 的新版本,但我不想升级到新版本,因为新版本与 OpenFrameworks 不兼容。我曾多次尝试从头开始重建项目,并且还查看了 VCXPROJ 文件并确认所有内容都设置为 V140 - 确实如此。一切都非常离奇。

It seems that on build, something is setting a requirement for v141 but I cannot seem to find where this is coming from. Does anyone have an idea?

似乎在构建时,有些东西为 v141 设置了要求,但我似乎无法找到它的来源。有没有人有想法?

回答by Alexander Bekman

I had such an issue. The solution is: open menu "Project"->Properties->Configuration Properites->General - and choose platform toolset v140.

我有这样的问题。解决方法是:打开菜单“项目”->属性->配置属性->常规-选择平台工具集v140。

回答by fiat

Had this same error trying to npm installafter cloning a node based project. It had an npm dependency that required C++ source to be compiled.

npm install在克隆基于节点的项目后尝试出现同样的错误。它有一个需要编译 C++ 源代码的 npm 依赖项。

I had already modified my VS2017install to include Individual Components-> VC++ 2017 version 15.7 v14.14 latest v141 tools

我已经修改了我的VS2017安装以包含Individual Components->VC++ 2017 version 15.7 v14.14 latest v141 tools

but that didn't help.

但这没有帮助。

I applied these commands in succession

我连续应用了这些命令

  1. npm install -g node-gyp

  2. npm install --global --production windows-build-tools

  1. npm install -g node-gyp

  2. npm install --global --production windows-build-tools

The first had no effect but the second did the trick and the npm installcommand completed successfully after that.

第一个没有效果,但第二个npm install成功了,之后命令成功完成。

回答by Chris Gong

This was addressed in the comments of one of the answers, but it worked for me. I had both v140 and v141 build tools installed, so when I had to use v140 build tools for something, I set the VCTargetsPathvariable to the path of the v140 build tools. Deleting this variable in my environment variables ultimately fixed this issue for me.

这在其中一个答案的评论中得到了解决,但它对我有用。我同时安装了 v140 和 v141 构建工具,因此当我不得不使用 v140 构建工具进行某些操作时,我将VCTargetsPath变量设置为 v140 构建工具的路径。在我的环境变量中删除这个变量最终为我解决了这个问题。

enter image description here

在此处输入图片说明

回答by RLH

For this error, and similar, for other platforms (e.g. VS2013) this problem typically occurs because you installed an older version of VS after you installed a later one. It's my observation that this will effect all of your Visual Studio C++ projects, and you will have to manually set them to target the specific toolset for the given version of VS you are trying to build the project under.

对于此错误,以及类似的,对于其他平台(例如 VS2013),此问题通常是因为您在安装较新版本后安装了较旧版本的 VS。根据我的观察,这将影响您的所有 Visual Studio C++ 项目,您必须手动设置它们以针对您尝试在其下构建项目的给定 VS 版本的特定工具集。

回答by Dattatraya Mengudale

enter image description here

在此处输入图片说明

If anyone has the same issue.. Reason: When someone tries to open existing solution which created/build on latest VS version (VS2015 / 2017) and tried to open with backward / old version of VS instance. Then this error might occur.

如果有人遇到同样的问题..原因:当有人尝试打开在最新 VS 版本(VS2015 / 2017)上创建/构建的现有解决方案并尝试使用向后/旧版本的 VS 实例打开时。那么可能会出现这个错误。

Please try below steps. Right click Project->Properties->Configuration Properties. Set 'Target Platform Version' as Supported OS version, i.e. for 8.1 > Win7 & 10 Win10 Set 'Platform tool set' as installed visual studio version.

请尝试以下步骤。右键单击项目->属性->配置属性。将“目标平台版本”设置为支持的操作系统版本,即对于 8.1 > Win7 & 10 Win10 将“平台工具集”设置为已安装的 Visual Studio 版本。

Re-Build & Enjoy :)

重新构建和享受:)