Main Content

Defines

R2026b

Add preprocessor macro definitions to the compiler command line

Model Configuration Pane: Code Generation / Custom Code

Description

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

Settings

'' (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.

Tips

To use the same custom code settings as those used for simulation, select Use the same custom code settings as Simulation Target. For more information, see Integrate External Code by Using Model Configuration Parameters.

Recommended Settings

ApplicationSetting
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