CPP(1) BSD Reference Manual CPP(1)
cpp - C preprocessor
cpp [-CdMtVv] [-D macro[=value]] [-I path] [-i file] [-S path] [-U macro]
[infile | -] [outfile]
The cpp utility is a macro preprocessor used by the pcc(1) compiler and
the X(7) Windowing System. It is used to include header files, expand
macro definitions, and perform conditional compilation.
The infile (input file) argument is optional. If not provided or the file
name is "-" (dash), cpp reads its initial file from standard input. The
outfile (output file) argument is also optional. It writes by default to
standard output.
The options are as follows:
-? Show command line usage for cpp.
-C Do not discard comments.
-D macro[=value]
Fake a definition at the beginning by using "#define
macro=value". If value is not set on the command line, then de-
fine it as 1.
-dM Print list of "#define" statements to standard output for all de-
fined macros other than builtin macros (see below). The normal
results of preprocessing are not output.
-I path
Add path to the list of directories containing needed header
files. This may be used to override system include directories
(see -S option). -I may be specified multiple times.
-i file
Include a file at the beginning by using "#include file".
-M Generate dependencies for make(1).
-P Inhibit generation of line markers. This is sometimes useful when
running the preprocessor on something other than C code.
-S path
Add path to the list of system directories containing needed
header files. The -S option may be specified multiple times.
Note: cpp does not have a default include directory defined.
-t Traditional cpp syntax. Do not define the __TIME__, __DATE__,
__STDC__, and __STDC_VERSION__ macros.
-U macro
Undefine a macro at the beginning by using "#undef macro".
-V Verbose debugging output. -V can be repeated for further details.
-v Display version.
Builtin Macros
A few macros are interpreted inside the cpp program:
__DATE__ Expands to the date in abbreviated month, day, and year
format from ctime(3) in quotes.
__FILE__ Expands to the name of the current input file in
quotes. When read from standard input, it expands to
"<stdin>".
__LINE__ Expands to the line number of the current line contain-
ing the macro.
__STDC__ Expands to the constant 1. This means the compiler con-
forms to ISO/IEC 9899:1990 ("ISO C90") (also known as
"ANSI C" or "C89").
__STDC_VERSION__ Expands to "199901L" which indicates that cpp supports
ISO/IEC 9899:1999 ("ISO C99").
__TIME__ Expands to the time in hour, minutes, and seconds from
ctime(3) in quotes.
Also see the -t option.
The cpp utility exits with one of the following values:
0 Successfully finished.
1 An error occurred.
as(1), ccom(1), pcc(1)
The cpp command comes from the original Portable C Compiler by S. C.
Johnson, written in the late 70's. The code originates from the V6
preprocessor with some additions from V7 cpp and ANSI / C99 support.
A lot of the PCC code was rewritten by Anders Magnusson.
This product includes software developed or owned by Caldera Internation-
al, Inc.
MirOS BSD #10-current November 18, 2008 1
Generated on 2008-11-18 21:40:59 by $MirOS: src/scripts/roff2htm,v 1.56 2008/02/24 12:47:18 tg Exp $
These manual pages are copyrighted
by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors.
The rest is Copyright © 2002-2008 The
MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.