21

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:

<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.

I found tons of references to the MSDN /MP page but 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?

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.

dwj
  • 3,443
  • 5
  • 35
  • 42

2 Answers2

35

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.

Community
  • 1
  • 1
Kirill V. Lyadvinsky
  • 97,037
  • 24
  • 136
  • 212
  • 1
    This worked. As a test I jammed it into the VCPROJ directly. After seeing your post, I added it to the section you show above -- it's exactly the same thing. – dwj Sep 14 '09 at 16:49
  • 5
    The difference between this and the Build-And-Run option is that /MP allows MULTIPLE FILES from ONE project to compile in parallel, while the build-and-run option allows MULTIPLE PROJECTS to build at the same time. The two options are orthogonal. – Armentage May 07 '12 at 12:32
  • 2
    You may also need to disable the /Gm option, which enables minimal rebuild, under Code Generation. – metal Oct 18 '12 at 16:01
  • To get all the CPU meters in Task Manager dancing at once, you might need to hardcode the number. For example, on a 6-core i5, /MP12 instead of just /MP. This depends on hyperthreading settings, etc. – Camille Goudeseune Apr 06 '14 at 18:58
  • @metal, so I have to trade off multi-core compilation of the entire project with single-core compilation of the minimum rebuild..? I'm either wasting cores or I'm doing an incredibly inefficient build.. :/ – James Bedford Oct 23 '14 at 15:51
5

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

Warren Young
  • 40,875
  • 8
  • 85
  • 101
  • Both my projects have "maximum number of parallel project builds" set to 2 (which is correct) but the original project shows the /MP switch and my new project doesn't. When I compile both projects, the original is definitely using multiple cores while the new one is not. – dwj Sep 14 '09 at 16:43
  • 8
    You will not switch on /MP build via that settings. This option will enable parallel builds of several projects in one solution, not several files in one project. This option suitable only for big solutions. – Kirill V. Lyadvinsky Sep 14 '09 at 16:43