Datasheet

C and C++ Compilers
2-6 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI 0067D
2.2.2 Included files
Several factors affect the way the ARM compilers search for
#include
header files and
source files. These include:
the
-I
and
-j
compiler options
the
-fk
and
-fd
compiler options
the value of the environment variable ARMINC
whether the filename is an absolute filename or a relative filename
whether the filename is between angle brackets or double quotes.
The in-memory file system
The ARM compilers have the ANSI C library headers built into a special,
textually-compressed, in-memory file system. By default, the C header files are used
from this file system for applications built from the command line. You can specify the
in-memory file system on the command line with
-j-
or
-I-
.
The C++ header files that are equivalent to the C library header files are also stored in
the in-memory file system. The header files specific to C++, such as
iostream
, are not
stored in the in-memory file system.
Enclosing a filename in angle brackets,
#include <stdio.h>
for example, indicates that
the included file is a system file and instructs the compiler to look in the in-memory file
system first.
Enclosing a filename in double quotes,
#include "myfile.h"
for example, indicates that
it is not a system file and instructs the compiler to look in the search path.
The current place
By default, the ARM compilers use Berkeley UNIX search rule, so source files and
#include
header files are searched for relative to the current place. This is the directory
containing the source or header file currently being processed by the compiler.
When a file is found relative to an element of the search path, the directory containing
that file becomes the new current place. When the compiler has finished processing that
file, it restores the previous current place. At each instant there is a stack of current
places corresponding to the stack of nested
#include
directives. For example, if the
current place is
install_directory\include
and the compiler is seeking the include file
sys\defs.h
, it locates
install_directory\include\sys\defs.h
if it exists.
When the compiler begins to process
defs.h
, the current place becomes
install_directory\include\sys
. Any file included by
defs.h
that is not specified with
an absolute pathname, is sought relative to
install_directory\include\sys
.