Sun Studio 12: C User's Guide

B.2.124.4 Directing the Compiler to Use a Specific Precompiled-Header File

You can also direct the compiler to use a specific precompiled header. Specify -xpch=use:pch_filename to do this. You can specify any number of source files with the same sequence of include files as the source file that was used to create the precompiled-header file. For example, your command in use mode could look like this: cc -xpch=use:foo.cpch foo.c bar.c foobar.c.

You should only use an existing precompiled-header file if the following are true. If any of the following is not true, you should recreate the precompiled-header file: