Sun Studio 12: C User's Guide

B.2.124.2 Creating a Precompiled-Header File Manually

If you decide to create your precompiled-header file manually, you must start by first using -xpch, and specifying the collect mode. The compilation command that specifies -xpch=collect must only specify one source file. In the following example, the -xpch option creates a precompiled-header file called myheader.cpch based on the source file a.c:

cc -xpch=collect:myheader a.c

A valid precompiled-header filename always has the suffix .cpch. When you specify pch_filename, you can add the suffix or let the compiler add it for you. For example, if you specify cc -xpch=collect:foo a.c, the precompiled-header file is called foo.cpch.