cpp Command cpp
C preprocessor
cpp [option...] [file...]
The command cpp calls the C preprocessor to perform C preproces-
sing. It performs the operations described in section 3.8 of the
ANSI Standard; these include file inclusion, conditional code
selection, constant definition, and macro definition. See the
entry on preprocessing for a full description of the C's
preprocessing language.
Normally, cpp is used to preprocess C programs, but it can be
used as a simple macro processor for other types of files as
well. cpp reads each input file, processes directives, and
writes its product on stdout. If the option -E is not used, cpp
also writes into its output statements of the form #linen
filename, so that the parser will be able to connect its error
messages and debugger output with the original line numbers in
your source files.
***** Options *****
The following summarizes cpp's options:
-DVARIABLE
Define VARIABLE for the preprocessor at compilation time.
For example, the command
cc -DLIMIT=20 foo.c
tells the preprocessor to define the variable LIMIT to be
20. The compiled program acts as though the directive
#define LIMIT 20 were included before its first line.
-E Strip all comments and line numbers from the source code.
This option is used to preprocess assembly-language files or
other sources, and should not be used with the other com-
piler phases.
-I directory
C allows two types of #include directives in a C program,
i.e., #include "file.h" and #include <file.h>. The -I
option tells cpp to search a specific directory for the
files you have named in your #include directives, in addi-
tion to the directories that it searches by default. You
can have more than one -I option on your cc command line.
-o file
Write output into file. If this option is missing, cpp
writes its output onto stdout, which may be redirected.
-UVARIABLE
Undefine VARIABLE, as if an #undef directive were included
in the source program. This is used to undefine the
COHERENT Lexicon Page 1
cpp Command cpp
variables that cpp defines by default.
***** See Also *****
C preprocessor, cc, commands
COHERENT Lexicon Page 2