Developer Guide and Reference

Contents

pch

Tells the compiler to use appropriate precompiled header files.

Syntax

Linux and macOS:
-pch
Windows:
None
Arguments
None
Default
OFF
The compiler does not create or use precompiled headers unless you tell it to do so.
Description
This option tells the compiler to use appropriate precompiled header (PCH) files. If none are available, they are created as
sourcefile.pchi
. This option is supported for multiple source files.
The
-pch
option will use PCH files created from other sources if the headers files are the same. For example, if you compile
source1.cpp
using
-pch
, then
source1.pchi
is created. If you then compile
source2.cpp
using
-pch
, the compiler will use
source1.pchi
if it detects the same headers.
Depending on how you organize the header files listed in your sources, this option may increase compile times.
Alternate Options
None
Consider the following command line:
icpc -pch source1.cpp source2.cpp
It produces the following output when
.pchi
files exist:
"source1.cpp": using precompiled header file"source1.pchi" "source2.cpp": using precompiled header file "source2.pchi"
It produces the following output when
.pchi
files
do not
exist:
"source1.cpp": creating precompiled header file "source1.pchi" "source2.cpp": creating precompiled header file "source2.pchi"