Visual Studio nmake 设置多核编译 /MP4 /MP8 关闭最小重新生成
方案1:
1、选择一个指定项目右击 -> 属性 -> 配置属性 -> C/C++ -> 命令行 在附加选项中输入:/MP4 或者/MP8 等,后面的那个数字是指定CPU 核的数量,可以自由更改;
2、上面的设置了之后还没有完,还有一个选项与上面的设置相冲突,如果不改的话将不起作用。 同样在【配置属性】-> C/C++ -> 代码生成 -> 启用最小重新生成 将这个选项修改为否。
这样就可以了,编译超快的。
类似linux 下的 make -j4 或者make -j8
//-------------------------------------------------------------------------------------------------------------------------
方案2:
Visual Studio 大工程项目的编译时间较长,可以利用多核CPU的优势,实现并行编译,
设置并行编译方法示例如下:
1.在“ClassView”中选取某项目的“Properties(属性)” 。
2.在之后打开的对话框中,左侧选择 “C/C++”->“General(常规)”中将“ Multi-processor Compilation(多处理器编译)”打开。
3.接着,“C/C++”->“Code Generation(代码生成)”中将“Enable Minimal Rebuild(启用最小重新生成)”关闭。
4.在“Debug(调试)”中选取项目的“Options and Settings (选项和设置)”->“Projects and Solutions (项目和解决方案)”->“ Build and Run (编译与运行)”中设置“ maximum number of parallel project builds(最大并发C++编译数)”(即开发项目机器本身的CPU所包含的核数)。
上述参数设置好后,就可以实现Visual Studio的并行编译了。
_________________________________________________________________________________________________________________________________________________
每一个不曾起舞的日子,都是对生命的辜负。
But it is the same with man as with the tree. The more he seeks to rise into the height and light, the more vigorously do his roots struggle earthward, downward, into the dark, the deep - into evil.
其实人跟树是一样的,越是向往高处的阳光,它的根就越要伸向黑暗的地底。----尼采
每一个不曾起舞的日子,都是对生命的辜负。
But it is the same with man as with the tree. The more he seeks to rise into the height and light, the more vigorously do his roots struggle earthward, downward, into the dark, the deep - into evil.
其实人跟树是一样的,越是向往高处的阳光,它的根就越要伸向黑暗的地底。----尼采