-D
Category
Pragma equivalent
None.
Purpose
Defines a macro as in a #define preprocessor directive.
Defaults
Not applicable.
Parameters
- name
- The macro you want to define. -Dname is equivalent to #define name. For example, -DCOUNT is equivalent to #define COUNT.
- definition
- The value to be assigned to name. -Dname=definition is equivalent to #define name definition. For example, -DCOUNT=100 is equivalent to #define COUNT 100.
Usage
Using the #define directive to define a macro name already defined by the -D option will result in an error condition.
The -Uname option, which is used to undefine macros defined by the -D option, has a higher precedence than the -Dname option.
Predefined macros
The compiler configuration file uses the -D option to predefine several macro names for specific invocation commands. For details, see the configuration file for your system.
Examples
To
specify that all instances of the name COUNT be replaced
by 100 in myprogram.c, enter:
xlc myprogram.c -DCOUNT=100