如何在 Visual Studio IDE (2008) 中打开多 CPU/核心 C++ 编译?

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

How do I turn on multi-CPU/Core C++ compiles in the Visual Studio IDE (2008)?

c++visual-studiocompilationmulticore

提问by dwj

I have a Visual Studio 2008 C++ project that has support for using multiple CPUs/cores when compiling. In the VCPROJ file I see this:

我有一个 Visual Studio 2008 C++ 项目,它支持在编译时使用多个 CPU/内核。在 VCPROJ 文件中,我看到了这个:

<Tool
    Name="VCCLCompilerTool"
    AdditionalOptions="/MP"
    ...

I can't find where that was turned added via the IDE and I want to set up another project that uses all of my cores during compilation.

我找不到通过 IDE 添加的位置,我想设置另一个在编译期间使用我所有内核的项目。

I found tons of references to the MSDN /MP pagebut that is for using the command line; I have yet to find any references to setting that with the IDE. How do I do that?

我发现了大量对MSDN /MP 页面的引用,但那是为了使用命令行;我还没有找到任何使用 IDE 进行设置的参考。我怎么做?

EDIT: To clarify, the two projects are completely separate and are not in the same VCPROJ file. I wanted to turn on support for multiple cores during the C++ compilation phase.

编辑:澄清一下,这两个项目是完全独立的,不在同一个 VCPROJ 文件中。我想在 C++ 编译阶段开启对多核的支持。

回答by Kirill V. Lyadvinsky

To enable /MP option you could add it to Project Settings->C/C++->Command Line|Additional options. This is the only way to switch it on in vcproj.

要启用 /MP 选项,您可以将其添加到Project Settings->C/C++->Command Line|Additional options. 这是在 vcproj 中打开它的唯一方法。

回答by Warren Young

Tools > Options > Projects and Solutions > Build and Run > maximum number of parallel project builds

工具 > 选项 > 项目和解决方案 > 构建和运行 > 并行项目构建的最大数量