C Preprocessor Command-Line Options

Previous The GNU C Preprocessor Next

Most often, when you use the C preprocessor, you will not have to invoke it explicitly: the C compiler will do so automatically. However, the preprocessor is sometimes useful on its own. All the options listed here are also acceptable to the C compiler and have the same meaning, except that the C compiler has different rules for specifying the output file.

Note: Whether you use the preprocessor by way of gcc or cpp, the compiler driver is run first. This program's purpose is to translate your command into invocations of the programs that do the actual work. Their command line interfaces are similar but not identical to the documented interface, and may change without notice.

The C preprocessor expects two file names as arguments, infile and outfile. The preprocessor reads infile together with any other files it specifies with #include. All the output generated by the combined input files is written in outfile.

Either infile or outfile may be '-', which as infile means to read from standard input and as outfile means to write to standard output. Also, if either file is omitted, it means the same as if '-' had been specified for that file.

Unless otherwise noted, or the option ends in =, all options which take an argument may have that argument appear either immediately after the option, or with a space between option and argument: '-Ifoo' and '-I foo' have the same effect.

Many options have multi-letter names; therefore multiple single-letter options may not be grouped: '-dM' is very different from '-d -M'.

For the actual command-line options, see GCC Options Controlling the Preprocessor.