Main Content

Language

Programming language of generated code

Model Configuration Pane: Code Generation

Description

The Language parameter specifies whether the code generator produces C or C++ code.

Dependencies

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

Settings

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

If you set the Code interface packaging parameter to C++ class, the code generator produces a C++ class interface. 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 code generator produces C++ compatible .cpp files that contain model interface code 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.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

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

Version History

Introduced in R2007a