Langue: en

Version: 371291 (fedora - 01/12/10)

Section: 1 (Commandes utilisateur)

BSD mandoc


cpp - C preprocessor


[-CdMtVv [-D macro[=value] ] ] [-I path ] [-i file ] [-S path ] [-U macro ] [infile ] [outfile ]


The utility is a macro preprocessor used by the pcc(1) compiler. It is used to include header files, expand macro definitions, and perform conditional compilation.

The infile input file is optional. If not provided or the file name is Qq - (dash), reads its initial file from standard input. The outfile output file is also optional. It writes by default to standard output.

The options are as follows:

Show command line usage for .
Do not discard comments.
-D macro[=value]
Fake a definition at the beginning by using Do #define macro=value Dc If value is not set on command-line, then define it as 1.
Print list of ``#define'' statements to standard output for all defined 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 Do #include file Dc
Generate dependencies for make(1).
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: does not have a default include directory defined.
Traditional cpp syntax. Do not define the __TIME__ __DATE__ __STDC__ and __STDC_VERSION__ macros.
-U macro
Undefine a macro at the beginning by using Do #undef macro Dc
Verbose debugging output. -V can be repeated for further details.
Display version.

Builtin Macros

A few macros are interpreted inside the cpp program:
Expands to the date in abbreviated month, day, and year format from ctime(3) in quotes.
Expands to the name of the current input file in quotes. When read from standard input, it expands to Qq Aq stdin .
Expands to the line number of the current line containing the macro.
Expands to the constant 1. This means the compiler conforms to St -isoC Po also known as Do C90 Dc Pc .
Expands to ``199901L'' which indicates that supports St -isoC-99 Po commonly referred to as Do C99 Dc Pc .
Expands to the time in hour, minutes, and seconds from ctime(3) in quotes.

Also see the -t option.


The utility exits with one of the following values:
Successfully finished.
An error occurred.


as(1), ccom(1), pcc(1)


The 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 International, Inc.