2.4.2. Manual PCH processing

You can specify the filename and location of PCH files, and the parts of a header file that are subject to PCH processing.

Specifying a PCH filename and location

You can specify the filename and location of the PCH file using the following command-line options:

  • --create_pch=filename

  • --use_pch=filename

  • --pch_dir=directory

If you use either --create_pch or --use_pch with the --pch_dir option, the indicated filename is appended to the directory name, unless the filename is an absolute path name.

Ordering PCH command-line options

The compiler cannot use these three options together on the same command line. If more than one of these options is specified, the following rule applies:

  • --use_pch takes precedence over --pch

  • --create_pch takes precedence over all other PCH options.

Most of the features of automatic PCH processing apply to one or other of these modes. For example, header stop points and PCH file applicability are determined in the same way.

Controlling PCH processing

You can specify that parts of a header file are subject to PCH processing using the following pragmas:

  • Insert a manual header stop point using the #pragma hdrstop directive in the primary source file before the first token that does not belong to a preprocessing directive.

    This enables you to specify where the set of header files that is subject to precompilation ends. For example,

    #include "xxx.h"
    #include "yyy.h"
    #pragma hdrstop
    #include "zzz.h"

    In this example, the PCH file includes the processing state for xxx.h and yyy.h but not for zzz.h. This is useful if you decide that the information following the #pragma hdrstop does not justify the creation of another PCH file.

  • Use the #pragma no_pch directive to suppress PCH processing for a source file.


You can use these pragmas even if you are using automatic PCH processing.

See Pragmas for more information.

Copyright © 2002-2007 ARM Limited. All rights reserved.ARM DUI 0205H