Using Precompiled Headers - Red Hat ENTERPRISE LINUX 4 Manual

Hide thumbs Also See for ENTERPRISE LINUX 4:
Table of Contents

Advertisement

120
CPATH
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH
OBJC_INCLUDE_PATH
Each variable's value is a list of directories separated by a special character, much like
which to look for header files. The special character,
determined at GCC build time. For Microsoft Windows-based targets it is a semicolon, and for
almost all other targets it is a colon.
specifies a list of directories to be searched as if specified with
CPATH
given with
options on the command line. This environment variable is used regardless of
-I
which language is being preprocessed.
The remaining environment variables apply only when preprocessing the particular language
indicated. Each specifies a list of directories to be searched as if specified with
after any paths given with
In all these variables, an empty element instructs the compiler to search its current working
directory. Empty elements can appear at the beginning or end of a path. For instance, if the value
of
is
CPATH
:/special/include
DEPENDENCIES_OUTPUT
If this variable is set, its value specifies how to output dependencies for Make based on the non-
system header files processed by the compiler. System header files are ignored in the dependency
output.
The value of
DEPENDENCIES_OUTPUT
written to that file, guessing the target name from the source file name. Or the value can have the
form
file target
name.
In other words, this environment variable is equivalent to combining the options
(Section 4.11 Options Controlling the Preprocessor), with an optional
SUNPRO_DEPENDENCIES
This variable is the same as
are not ignored, so it implies
is omitted. Section 4.11 Options Controlling the Preprocessor.

4.20. Using Precompiled Headers

Often large projects have many header files that are included in every source file. The time the com-
piler takes to process these header files over and over again can account for nearly all of the time
required to build the project. To make builds faster, GCC allows users to 'precompile' a header file;
then, if builds can use the precompiled header file they will be much faster.
Caution: There are a few known situations where GCC will crash when trying to use a precompiled
header. If you have trouble with a precompiled header, you should remove the precompiled header
and compile without it. In addition, please use GCC's on-line defect-tracking system to report any
problems you encounter with precompiled headers.
To create a precompiled header file, simply compile it as you would any other file, if necessary using
the
option to make the driver treat it as a C or C++ header file. You will probably want to use a
-x
tool like
to keep the precompiled header up-to-date when the headers it contains change.
make
A precompiled header file will be searched for when
searches for the included file () the compiler looks for a precompiled header in each directory just
options on the command line.
-isystem
, that has the same effect as
can be just a file name, in which case the Make rules are
, in which case the rules are written to file
DEPENDENCIES_OUTPUT
rather than
-M
Chapter 4. GCC Command Options
PATH_SEPARATOR
-I. -I/special/include
file
(see above), except that system header files
. However, the dependence on the main input file
-MM
is seen in the compilation. As it
#include
PATH
, is target-dependent and
, but after any paths
-I
-isystem
using
as the target
target
and
-MM
switch too.
-MT
, in
, but
.
-MF

Advertisement

Table of Contents
loading

Table of Contents