3.25 Precompiled Header (PCH) file creation requirements
A PCH file is produced only if the header stop point and the code preceding it, mainly the header files, meet specific requirements.
These requirements are as follows:
The header stop point must appear at file scope. It must not be within an unclosed
scope established by a header file. For example, a PCH file is not created in this
The header stop point must not be inside a declaration that is started within a
header file. Also, in C++, it must not be part of a declaration list of a linkage
specification. For example, in the following case the header stop point is
int, but because it is not the start of a new declaration, no PCH
file is created:
The header stop point must not be inside a
#if block or a
#define that is started within a header file.
The processing that precedes the header stop point must not have produced any
Warnings and other diagnostics are not reproduced when the PCH file is reused.
No references to predefined macros
__TIME__ must appear.
No instances of the
#line preprocessing directive must
#pragma no_pch must not appear.
The code preceding the header stop point must have introduced a sufficient number of
declarations to justify the overhead associated with precompiled headers.