Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 12/16/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of 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.

CAUTION:

Depending on how you organize the header files listed in your sources, this option may increase compile times.

IDE Equivalent

Visual Studio: None

Eclipse: Precompiled Headers > Automatic Processing for Precompiled Headers

Xcode: None

Alternate Options

None

Example

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"

See Also