When to Precompile Source Code

Home

Precompiled code is useful during the development cycle to reduce compilation time, especially if:

The first compilation—the one that creates the precompiled header file—takes a bit longer than subsequent compilations. Subsequent compilations can proceed more quickly by including the precompiled code.

You can precompile both C and C++ programs. In C++ programming, it is common practice to separate class interface information into header files. These header files can later be included in programs that use the class. By precompiling these headers, you can reduce the time a program takes to compile.

Note   Although you can use only one precompiled header (.PCH) file per source file, you can use multiple .PCH files in a project.