Create Precompiled Header Files

To create a precompiled header file, the compiler process must have write permission to the directories you specify, or to the current working directories if none are specified.

Create a Precompiled Header
To automatically create and maintain precompiled header files, use the /Fi and /Si compiler options together. Precompiled header files will be created if they do not exist, and will be used if they do. When a source file changes, the precompiled version is automatically regenerated.

Create Multiple Precompiled Headers
There are two ways you can specify the name of an additional precompiled header file, or an alternative directory to search:

Filenames specified with the pragma take precedence over those specified with the options.

The default filenames are:

The default directory is the current working directory.



Precompiled Headers
Initial Sequence of Headers


Use Precompiled Header Files


Examples of Using Compiler Options and #pragma hdrfile