gpt4 book ai didi

c++ - Visual Studio 中的 "multi-processor compilation"有什么缺点吗?

转载 作者:IT老高 更新时间:2023-10-28 12:53:46 26 4
gpt4 key购买 nike

在 Visual Studio for C++ 项目中使用“多处理器编译”选项时,是否有任何缺点、副作用或其他问题需要注意?或者,换一种说法,为什么在 Visual Studio 中这个选项默认是关闭的?

最佳答案

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.

它给出了一个表格,列出了与/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)

Visual Studio 不是默认禁用这些其他选项(并默认启用 /MP),而是让您手动禁用/阻止这些功能并启用 /MP

关于c++ - Visual Studio 中的 "multi-processor compilation"有什么缺点吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13980097/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com