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.

1
  • 1
    Useful to know as well - the /MP option also works on Visual Studio 2005. Sep 14, 2009 at 19:58

2 Answers 2

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.

5
  • 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, 2009 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 7, 2012 at 12:32
  • 2
    You may also need to disable the /Gm option, which enables minimal rebuild, under Code Generation.
    – metal
    Oct 18, 2012 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. Apr 6, 2014 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.. :/ Oct 23, 2014 at 15:51
5

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

2
  • 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, 2009 at 16:43
  • 7
    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. Sep 14, 2009 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.