Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)?
Many thanks.
Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)?
Many thanks.
make
will do this for you. Investigate the-j
and-l
switches in the man page. I don't thinkg++
is parallelizable.People have mentioned
make
butbjam
also supports a similar concept. Usingbjam -jx
instructs bjam to build up tox
concurrent commands.We use the same build scripts on Windows and Linux and using this option halves our build times on both platforms. Nice.