As the project grows, the time it takes to compile is longer. In order to improve the efficiency of compiling, we can turn on multithreading to improve the speed of compiling, and make full use of the performance of multi-core machine to optimize the compilation.
1.windows.
Currently we use vs2012 to compile the project under Windows. VS can turn on multi-core compilation in the following ways
First multi-processor compilation selection "Yes (/MP)" in the C/s + + option of the project
Then select "No (/gm-)" in "Enable minimum build" in code generation inside.
Then recompile, you will find that the compilation speed will be improved a lot. 2.linux. Linux we use Qtcreator to compile the project. Qtcreator can turn on multithreaded compilation by first checking how many threads your computer's CPU supports (using virtual machines to see how many processor cores are allocated in the virtual machine settings), and if 8, in the Qtcreator project settings, Add the parameter-j8 to make in the build step as follows:this way, your compilation speed will be greatly improved ^ ^!
Turn on multithreading to speed up compilation