-D: Macro Definition

Group

LANGUAGE

Scope

Compilation Unit

Syntax
  -D<identifier>[=<value>]
  
  
Arguments

<identifier>: identifier to be defined

<value>: value for <identifier>, anything except - and <a blank>

Default

None

Defines

None

Pragmas

None

Description

The Compiler allows the definition of a macro on the command line. The effect is the same as having a # define directive at the very beginning of the source file.

  -DDEBUG=0
  
  

This is the same as writing:

  #define DEBUG 0
  
  

in the source file.

If you need strings with blanks in your macro definition, there are two ways. Either use escape sequences or double quotes:

  -dPath="Path\40with\40spaces"
  
  
  -d"Path=""Path with spaces"""
  
  
Note: Blanks are not allowed after the -D option; the first blank terminates this option. Also, macro parameters are not supported.