Precompiled Headers Command Line Options for Clang-enhanced C++ Compilers

From RAD Studio
Jump to: navigation, search

Go Up to Clang-enhanced C++ Compilers


Precompiled header files can dramatically increase compilation speed by storing an image of the symbol table on disk in a file, then later reloading that file from disk instead of parsing all the header files again. Directly loading the symbol table from disk is much faster than parsing the text of header files, especially if several source files include the same header file.

To use precompiled header files on the command line, use the following options in your Clang-enhanced C++ compiler command.

Precompiled Header Options:

Compiler Option Description Details Example
-emit-pch

Generates a PCH file

Option used to generate a new precompiled header file.

<compiler> -emit-pch -o PCHfile.pch TestPCH.h

-include-pch

Includes a PCH file

Option that can be used to includes a PCH file in a C++ source file.

<compiler> -emit-obj -include-pch PCHfile.pch SourceFile.cpp


See Also