C++ Visual Studio 2015 将目标平台更改为 windows 7

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34706246/
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 14:24:52  来源:igfitidea点击:

Visual Studio 2015 Change target platform to windows 7

c++windowsvisual-studio-2015

提问by culi0x

How can I change the target platform to Windows 7? All I can chose is Windows 8.1 and therefore my project does not run on Windows 7. The same project I used to compile on my old Windows 7 PC with Visual Studio 2013. And of course it worked there.

如何将目标平台更改为 Windows 7?我只能选择 Windows 8.1,因此我的项目不能在 Windows 7 上运行。我曾经在使用 Visual Studio 2013 的旧 Windows 7 PC 上编译的同一个项目。当然它在那里工作。

I already tried to install Windows 7 SDK but sadly this does not work since it requites Net Framework 4.0 which I can not install anymore. (Windows 10 includes 4.6?) - https://msdn.microsoft.com/en-us/en-en/library/ff770576.aspx

我已经尝试安装 Windows 7 SDK,但遗憾的是这不起作用,因为它需要我无法再安装的 Net Framework 4.0。(Windows 10 包括 4.6?) - https://msdn.microsoft.com/en-us/en-en/library/ff770576.aspx

Thanks.

谢谢。

回答by melak47

From MSDN:

MSDN

Target Platform Version

[...]

To target Windows 7 or Windows Vista, use the value 8.1, since Windows SDK 8.1 is backward compatible to those platforms. In addition, you should define the appropriate value for _WIN32_WINNT in targetver.h. For Windows 7, that's 0x0601. See Modifying WINVER and _WIN32_WINNT.

目标平台版本

[...]

要面向 Windows 7 或 Windows Vista,请使用值 8.1,因为 Windows SDK 8.1 向后兼容这些平台。此外,您应该在 targetver.h 中为 _WIN32_WINNT 定义适当的值。对于 Windows 7,这是 0x0601。请参阅修改 WINVER 和 _WIN32_WINNT

回答by Chris

To get additional target platforms (i.e. older Visual C compilers), install the respective older Visual Studio version(s) in parallel.

要获得其他目标平台(即较旧的 Visual C 编译器),请并行安装相应的较旧 Visual Studio 版本。

For instance, if you want to use Visual Studio 2017 in the GUI and want to build against VC2008 (msvc90), install Visual Studio 2008 in parallel to Visual Studio 2017. In VS2017, in the build settings, you can then select the "VC 2008" build target.

例如,如果您想在 GUI 中使用 Visual Studio 2017 并想针对 VC2008 (msvc90) 进行构建,请与 Visual Studio 2017 并行安装 Visual Studio 2008。在 VS2017 中,在构建设置中,您可以选择“VC 2008”构建目标。

Also see: https://poweruser.blog/visual-studio-2017-compile-against-older-visual-c-c-runtimes-372519fe1400

另见:https: //poweruser.blog/visual-studio-2017-compile-against-older-visual-cc-runtimes-372519fe1400