Sun Studio 12: C User's Guide

B.2.124.1 Creating a Precompiled-Header File Automatically

You can let the compiler generate the precompiled- header file for you automatically. Choose between one of the following two ways to do this. One way is for the compiler to create the precompiled-header file from the first include file it finds in the source file. The other way is for the compiler to select from the set of include files found in the source file starting with the first include file and extending through a well- defined point that determines which include file is the last one. Use one of the following two flags to determine which method the compiler uses to automatically generate a precompiled header:

Table B–34 The -xpch Flags

Flag  

Meaning  

-xpch=auto

The contents of the precompiled-header file is based on the longest viable prefix (see the following section for an explanation of how a viable prefix is identified) that the compiler finds in the source file. This flag produces a precompiled header file that consists of the largest possible number of header files. 

-xpch=autofirst

This flag produces a precompiled-header file that contains only the first header found in the source file.