Main Content

Language

Description

Specify C or C++ code generation for simulation targets. This configuration parameter affects:

  • Model reference simulation targets.

  • Rapid accelerator simulation targets.

  • Custom code you implement with C Function blocks, C Caller blocks, MATLAB Function blocks, MATLAB System blocks, and Stateflow® charts. If Import custom code is selected, available custom code variables and functions are parsed.

The Simulation cache folder configuration parameter determines where to save the generated C or C++ files.

Category: Simulation Target

Settings

Default: C

C

Generates C code for simulation targets.

C++

Generates C++ code for simulation targets.

Select the C++ option to:

  • Generate MATLAB Function block or Stateflow chart MEX code as C++ files and compile code using C++. For MATLAB Function and MATLAB System blocks, if you add C++ code to buildInfo using coder.updateBuildInfo or coder.ExternalDependency, set Language to C++.

  • Simulate a MATLAB System block through code generation and compilation using C++.

A model cannot have a C++ simulation target if it contains a Simscape™ block with a source file that contains MATLAB® functions.

Before you build a system, configure Simulink® to use a compiler system using mex -setup.

Command-Line Information

Parameter: SimTargetLang
Value: 'C' | 'C++'
Default: 'C'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Related Topics