Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any disadvantages to "multi-processor compilation" in Visual Studio?

Are there any disadvantages, side effects, or other issues I should be aware of when using the "Multi-processor Compilation" option in Visual Studio for C++ projects? Or, to phrase the question another way, why is this option off by default in Visual Studio?

like image 502
JBentley Avatar asked Dec 20 '12 20:12

JBentley


1 Answers

The documentation for /MP says:

Incompatible Options and Language Features
The /MP option is incompatible with some compiler options and language features. If you use an incompatible compiler option with the /MP option, the compiler issues warning D9030 and ignores the /MP option. If you use an incompatible language feature, the compiler issues error C2813then ends or continues depending on the current compiler warning level option.
Note:
Most options are incompatible because if they were permitted, the concurrently executing compilers would write their output at the same time to the console or to a particular file. As a result, the output would intermix and be garbled. In some cases, the combination of options would make the performance worse.

And it gives a table that lists compiler options and language features that are incompatible with /MP:

  • #import preprocessor directive (Converts the types in a type library into C++ classes, and then writes those classes to a header file)
  • /E, /EP (Copies preprocessor output to the standard output (stdout))
  • /Gm (Enables an incremental rebuild)
  • /showIncludes (Writes a list of include files to the standard error (stderr))
  • /Yc (Writes a precompiled header file)

Instead of disabling those other options by default (and enabling /MP by default), Visual Studio makes you manually disable/prevent these features and enable /MP.

like image 200
Cornstalks Avatar answered Oct 04 '22 03:10

Cornstalks