Syntax
-D
name
-D
name
=
value
Description
You can define preprocessor macros using the -D option. The macro definitions are passed on to the respective language compiler which is responsible for interpreting the definitions and providing them to the programmer within the language.
The first form above defines the macro name but without an associated replacement value, and the second defines the same macro with the replacement value value.
Setting this in CrossStudio
To define preprocessor macros for a project:
- Select the project in the Project Explorer.
- In the Preprocessor Options group edit the Preprocessor Definitions property.
To define preprocessor macros for a particular file:
- Select the file in the Project Explorer.
- In the Preprocessor Options group edit the Preprocessor Definitions property.
The Preprocessor Definitions property is a semicolon-separated list of macro definitions, for example “name1=value1;name2=value2”. Clicking the button at the right of the property displays the Preprocessor Definitions dialog which will allow you to easily edit the definitions.
Example
The following defines two macros, SUPPORT_FLOAT with a value of 1 and LITTLE_ENDIAN with no replacement value.
-DSUPPORT_FLOAT=1 -DLITTLE_ENDIAN