Main Content


Add preprocessor macro definitions to the compiler command line

Model Configuration Pane: Code Generation / Custom Code


Specify preprocessor macro definitions to be added to the compiler command line.


'' (default) | string

Enter a list of macro definitions for the compiler command line. Specify the parameters with a space-separated list of macro definitions. If a makefile is generated, these macro definitions are added to the compiler command line in the makefile. The list can include simple definitions (for example, -DDEF1), definitions with a value (for example, -DDEF2=1), and definitions with a space in the value (for example, -DDEF3="my value"). Definitions can omit the -D (for example, -DFOO=1 and FOO=1 are equivalent). If the toolchain uses a different flag for definitions, the code generator overrides the -D and uses the appropriate flag for the toolchain.

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: CustomDefine
Type: character vector
Value: preprocessor macro definition
Default: ''

Version History

Introduced in R2016a