4.26 Precompiled Header (PCH) file processing and the header stop point

The PCH file contains a snapshot of all the code that precedes a header stop point.

Note:

Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05 onwards on all platforms. Note that ARM Compiler on Windows 8 never supported PCH files.

Typically, the header stop point is the first token in the primary source file that does not belong to a preprocessing directive. In the following example, the header stop point is int and the PCH file contains a snapshot that reflects the inclusion of xxx.h and yyy.h:

#include "xxx.h"
#include "yyy.h"
int i;

You can manually specify the header stop point with #pragma hdrstop. If you use this pragma, it must appear before the first token that does not belong to a preprocessing directive. In this example, it must be placed before int, as follows:

#include "xxx.h"
#include "yyy.h"
#pragma hdrstop
int i;

If a conditional directive block (#if, #ifdef, or #ifndef) encloses the first non-preprocessor token or #pragma hdrstop, the header stop point is the outermost enclosing conditional directive.

For example:

#include "xxx.h"
#ifndef YYY_H
#define YYY_H 1
#include "yyy.h"
#endif
#if TEST /* Header stop point lies immediately before #if TEST */
int i;
#endif

In this example, the first token that does not belong to a preprocessing directive is int, but the header stop point is the start of the #if block containing it. The PCH file reflects the inclusion of xxx.h and, conditionally, the definition of YYY_H and inclusion of yyy.h. It does not contain the state produced by #if TEST.

Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.