Language

Description

Specify C or C++ code generation.

Category: Code Generation

Settings

Default: C

C

Generates C code and places the generated files in your build folder.

C++

Generates C++ code and places the generated files in your build folder.

On the Code Generation > Interface pane, if you additionally set the Code interface packaging parameter to C++ class, the build generates a C++ class interface to model code. The generated interface encapsulates required model data into C++ class attributes and model entry point functions into C++ class methods.

If you set Code interface packaging to a value other than C++ class, the build generates C++ compatible .cpp files containing model interfaces enclosed within an extern "C" link directive.

You might need to configure the Simulink® Coder™ software to use a compiler before you build a system.

Dependencies

Selecting C++ enables and selects the value C++ class for the Code interface packaging parameter on the Code Generation > Interface pane.

Command-Line Information

Parameter: TargetLang
Type: character vector
Value: 'C' | 'C++'
Default: 'C'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Related Topics