3.24 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.

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.
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 case:
    // xxx.h
    class A
    {
        // xxx.c
        #include "xxx.h"
        int i;
    }; 
    
  • 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:
    // yyy.h
    static
    // yyy.c
    #include "yyy.h"
    int i; 
    
  • 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 errors.

    Note

    Warnings and other diagnostics are not reproduced when the PCH file is reused.
  • No references to predefined macros __DATE__ or __TIME__ must appear.
  • No instances of the #line preprocessing directive must appear.
  • #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.
Related concepts
3.22 Automatic Precompiled Header (PCH) file processing
3.23 Precompiled Header (PCH) file processing and the header stop point
3.21 Precompiled Header (PCH) files
3.22 Automatic Precompiled Header (PCH) file processing
3.23 Precompiled Header (PCH) file processing and the header stop point
3.25 Compilation with multiple Precompiled Header (PCH) files
3.26 Obsolete Precompiled Header (PCH) files
3.27 Manually specifying the filename and location of a Precompiled Header (PCH) file
3.28 Selectively applying Precompiled Header (PCH) file processing
3.29 Suppressing Precompiled Header (PCH) file processing
3.30 Message output during Precompiled Header (PCH) processing
3.31 Performance issues with Precompiled Header (PCH) files
3.25 Compilation with multiple Precompiled Header (PCH) files
3.26 Obsolete Precompiled Header (PCH) files
3.27 Manually specifying the filename and location of a Precompiled Header (PCH) file
3.28 Selectively applying Precompiled Header (PCH) file processing
3.29 Suppressing Precompiled Header (PCH) file processing
3.30 Message output during Precompiled Header (PCH) processing
3.31 Performance issues with Precompiled Header (PCH) files
Related reference
7.129 --pch
7.130 --pch_dir=dir
7.131 --pch_messages, --no_pch_messages
7.132 --pch_verbose, --no_pch_verbose
9.83 #pragma hdrstop
9.88 #pragma no_pch
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.