Example of an Initial Sequence for Precompiled C Headers

Here is the start of a C program, and its header files:

main C source header files
/* Comments are OK */ 
#define M 1 
#undef N
#line 10
#if F
   int f(int);
#endif
#if STDIO 
   #include <stdio.h>
#endif
#include "h1.h"
/* Comments are OK */
#
#include "h2.h" 
#include "h3.h" 
main() { 
}
/* h1.h */
int h1;
#include "h3.h"
/* h2.h */
int h2;
*/ h3.h */
#ifndef H3_H
#define H3_H
   int h3;
#endif

The initial sequence can vary, depending on whether any macros are defined by the define configuration option.

Macros defined Resulting initial sequence
None "h1.h", "h2.h"
STDIO <stdio.h>, "h1.h", "h2.h"
F No initial sequence because int f(int) occurs before any #include directives

Although h3.h is included twice (once in main.c and once in h1.c), only the first #include is considered in the initial sequence, because the second #include does not take effect.

Example Matching Initial Sequences for C Precompiled Headers
Examples of Multiple Initial Sequences for C Precompiled Headers



C Compilation
Precompiled C Headers
Organizing Your C Source for Precompiled Headers


Set Build Options
Build


C File Options