HP C/iX Reference Manual (31506-90011)
98 Chapter7
Preprocessing Directives
Source File Inclusion
Examples
#include <stdio.h>
#include "myheader"
#ifdef MINE
# define filename "file1"
#else
# define filename "file2"
#endif
#include filename
Preprocessor Search of Include Files in Quotation Marks
The preprocessor searches for include files enclosed in double quotation marks, (for
example #include myfile), as follows:
1. If the include
filename
contains an MPE/iX group and account name, then the
preprocessor searches the specified group and account. If no group and account is
specified, it searches the group and account where the source file resides. If
filename
is
not found, the preprocessor performs step 2.
2. The preprocessor removes any extensions and adds the H group to
filename
. It then
searches the H group of the account where the source file resides. If the preprocessor
does not find
filename
, it performs step 3.
3. The preprocessor adds the SYS account to
filename
.H and searches for
filename
.H.SYS.
4. If the
filename
is still not found, the preprocessor issues an error.
Examples
#include "MYFILE"
The preprocessor starts by looking for MYFILE in the group and account where the source
file is located. It then looks for MYFILE.H in the account where the source file is located,
and finally looks for MYFILE.H.SYS.
#include "MYFILE.X"
Assuming the source file is located in SRCGROUP.SRCACCT, the preprocessor looks for the
include file in the following order:
1. MYFILE.X.SRCACCT
2. MYFILE.SRCGROUP.SRCACCT
3. MYFILE.H.SRCACCT
4. MYFILE.H.SYS
Include Files Within Include Files
Files that are included can also use the #include directive. The compiler supports up to 35