HP C A.06.05 Reference Manual
Preprocessing Directives
Source File Inclusion (#include)
Chapter 7188
Source File Inclusion (#include)
You can include the contents of other files within the source file using the #include directive.
Syntax
include-directive
::=
#include <
filename
>
#include "
filename
"
#include
identifier
Description
In the third form above,
identifier
must be in the form of one of the first two choices after
macro replacement.
The #include preprocessing directive causes the compiler to switch its input file so that
source is taken from the file named in the include directive. Historically, include files are
named:
filename
.h
If the file name is enclosed in double quotation marks, the compiler searches your current
directory for the specified file. If the file name is enclosed in angle brackets, the “system”
directory is searched to find the named file. Refer to Chapter 10 for a detailed description of
how the directory is searched.
Files that are included may contain #include directives themselves. The HP C compiler
supports a nesting level of at least 35 #include files.
The arguments to the #include directive are subject to macro replacement before the
directive processes them. Error messages produced by the HP C compiler usually supply the
file name the error occurred in as well as the file relative line number of the error.
Examples
#include <stdio.h>
#include "myheader"
#ifdef MINE
# define filename "file1"