User's Guide
Preprocessor Options
The following options are accepted by the preprocessor:
-C
-C
Using the -C option prevents the preprocessor from stripping comments. See the description of
cpp in the cpp(1) manpage for details.
-dM
-dM
When -dM is present, instead of normal preprocessor output the compiler lists the #define
directives it encounters as it preprocesses the file, thus providing a list of all macros that are in
effect at the start of the compilation. The -dM option requires that -P or -E also be specified.
A common use of this option is to determine the compiler's predefined macros. For example:
touch foo.c ; cc -E -dM foo.c
-Dname
-Dname[=def]
name is the symbol name that is defined for the preprocessor.
def is the definition of the symbol name (name).
The -Dname option defines a symbol name (name) to the preprocessor, as if defined by the
preprocessing directive#define.
If no definition (def) is given, the name is defined as 1.
NOTE: __ia64 and __HP_aCC are defined automatically.
Example:
The following example defines the preprocessor symbol DEBUGFLAG and gives it the value 1.
aCC -DDEBUGFLAG file.C
The following program uses this symbol:
#include <iostream.h>
int main(){
int i, j;
#ifdef DEBUGFLAG
int call_count=0;
#endif
/* ... */
}
-E
-E
Using the -E option runs only the preprocessor on the named C++ files and sends the result to
standard output (stdout).
An exception to this rule is when-E is used with +Make[d] option, the only output is the make
dependency information. Unlike the -P option, the output of -E contains #line entries indicating
the original file and line numbers.
Redirecting Output From This Option
Use the -.suffix option to redirect the output of this option.
72 Command-Line Options