如何使Visual Studio 2015 C ++项目与Visual Studio 2010兼容? [英] How do I make a Visual Studio 2015 C++ project compatible with Visual Studio 2010?

查看:193
本文介绍了如何使Visual Studio 2015 C ++项目与Visual Studio 2010兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的老师很愿意在学校使用Visual Studio 2010,因为他们不想打扰安装新的东西.我一直在使用Visual Studio 2015,真的很喜欢它.但是,当她尝试运行任何代码时,都会产生很多错误.我尝试通过编辑解决方案文件使2013/2012项目与2010兼容的解决方案,但仍会产生错误.有解决办法吗?

My teacher is horsed to use Visual Studio 2010 by the school, because they don't want to bother installing anything new. I've been using Visual Studio 2015 and am really liking it. However, when she tries to run any of the code, it produces a bunch of errors. I tried a solution for making 2013/2012 projects compatible with 2010 by editing the solution file, but it still produces errors. Is there a solution?

当我尝试在Visual Studio 2010中运行源文件时,这是控制台输出:

Here is the console output when I try to run the source file in Visual Studio 2010:

1>------ Build started: Project: typingSalon, Configuration: Debug Win32 ------
1>Build started 4/8/2015 8:19:30 AM.
1>Project file contains ToolsVersion="14.0". This toolset is unknown or missing. You may be able to resolve this by installing the appropriate .NET Framework for this toolset. Treating the project as if it had ToolsVersion="4.0".
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(518,5): error MSB8008: Specified platform toolset (v140) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.05
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

推荐答案

问题是项目文件引用了v140 C ++工具集,这基本上意味着使用Visual Studio 2015的C ++编译器.未安装此编译器,这会导致您出现错误消息.

The problem is that the project file references the v140 C++ toolset, which basically means use the C++ compiler from Visual Studio 2015. This compiler is not installed, which causes your error message.

从我的头上来看,有两种方法可以帮助您克服困境:

From the top of my head, there are two ways for you to overcome your situation:

  • 在计算机上安装Visual Studio 2010.然后,从2015年之内,在项目设置中选择2010年平台工具集.这样,您的项目将始终使用2010进行编译,但是您可以避免意外使用2010年没有的C ++功能.

  • Install Visual Studio 2010 on your computer. Then, from within 2015, select the 2010 platform toolset in the project settings. Your project will then always be compiled with 2010, but you have the advantage to not accidentally use C++ features that 2010 does not have.

不要在您的计算机上安装Visual Studio 2010,而是使用第二台计算机(仅安装了2010年)创建第二个生成配置,该配置将平台工具集设置为Visual Studio 2010(v100) .根据您使用的Visual Studio使用适当的配置.

Don't install Visual Studio 2010 on your computer, but use the second computer (with just 2010 installed) to create a second build configuration, which has the platform toolset set to Visual Studio 2010 (v100). Use the appropriate configuration depending on which Visual Studio you use.

这两种解决方案基本上都意味着您没有使用Visual Studio 2015的改进的C ++功能,而不是Visual Studio 2010,这是很不幸的.

Both of these solutions basically mean you do not use the improved C++ capabilities of Visual Studio 2015 over Visual Studio 2010, which is somewhat unfortunate.

这篇关于如何使Visual Studio 2015 C ++项目与Visual Studio 2010兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆