PreCompiled Header (PCH) file processing and the header stop point
ARM Compiler
toolchain v5.02 for µVision Using the Compiler
Home > Compiler Features > PreCompiled Header (PCH)
file processing and the header stop point
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. 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;
The header stop point can be manually specified with #pragma
hdrstop. If used, this pragma must be placed 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 #if block encloses the first non-preprocessor
token or #pragma hdrstop, the header stop point is
the outermost enclosing #if. 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.
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.