Using Options to Define Macros

You can use compiler options to define or undefine predefined macros.

Using -D

Use this option to define a macro. For example, to define a macro called SIZE with the value 100 use the following command:

icpc -DSIZE=100 prog1.cpp

If you define a macro, but do not assign a value, the compiler defaults to 1 for the value of the macro.

Using -U

Use this option to undefine a macro. For example, this command:

icpc -Uia32 prog1.cpp

undefines the ia32 predefined macro. If you attempt to undefine an ANSI C macro, the compiler will emit an error:

invalid macro undefinition: <name of macro>

Note

If you use -D and -U in the same compilation, the compiler processes the -D option before -U, rather than processing them in the order they appear on the command line.

See Also