IBM Support

Configuring Simulink 2015 code generation with IBM Rational Rhapsody

Troubleshooting


Problem

Generated code from a Simulink model can be successfully imported into a <SimulinkBlock> but the code will not compile within IBM Rational Rhapsody.

Symptom

This is following the workflow outlined in the IBM Rational Rhapsody documentation

Compiling the project afterwards results in the following compiler errors.

Please note, the name of the Simulink model is represented here as <simulink_model_name>

Building ------------ DefaultComponent.exe ------------
Executing: ""C:\Rhapsody8.1.3\Share"\etc\msvcmake.bat DefaultComponent.mak build x86 VC10 "
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
class_0.cpp
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(188) : error C2146: syntax error : missing ';' before identifier '<simulink_model_name>_B'
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(188) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(188) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(190) : error C2143: syntax error : missing ';' before '*'
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(190) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(190) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(192) : error C2146: syntax error : missing ';' before identifier '<simulink_model_name>_M_'
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(192) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(192) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(194) : error C2146: syntax error : missing ';' before identifier '<simulink_model_name>_P'
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(194) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(194) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(196) : error C2146: syntax error : missing ';' before identifier '<simulink_model_name>_U'
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(196) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(196) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(198) : error C2146: syntax error : missing ';' before identifier '<simulink_model_name>_X'
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(198) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(198) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(200) : error C2146: syntax error : missing ';' before identifier '<simulink_model_name>_Y'
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(200) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\workspace\06622\importtest\project\defaultcomponent\defaultconfig\class_0.h(200) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
class_0.cpp(90) : error C2065: 'rtM' : undeclared identifier
class_0.cpp(90) : error C2351: obsolete C++ constructor initialization syntax
class_0.cpp(90) : error C2612: trailing '(' illegal in base/member initializer list
class_0.cpp(90) : error C2065: '<simulink_model_name>_M_' : undeclared identifier
class_0.cpp(90) : error C2143: syntax error : missing ';' before '{'
class_0.cpp(98) : error C2143: syntax error : missing ';' before '{'
class_0.cpp(102) : error C2601: 'class_0::SetValue' : local function definitions are illegal
class_0.cpp(108) : error C2601: 'class_0::doStep' : local function definitions are illegal
class_0.cpp(116) : error C2601: 'class_0::setPosition' : local function definitions are illegal
class_0.cpp(124) : error C2601: 'class_0::setVitesse' : local function definitions are illegal
class_0.cpp(132) : error C2601: 'class_0::getPosition_SP' : local function definitions are illegal
class_0.cpp(136) : error C2601: 'class_0::get_position_SP' : local function definitions are illegal
class_0.cpp(140) : error C2601: 'class_0::getVitesse_SP' : local function definitions are illegal
class_0.cpp(144) : error C2601: 'class_0::get_vitesse_SP' : local function definitions are illegal
class_0.cpp(148) : error C2601: 'class_0::getPosition' : local function definitions are illegal
class_0.cpp(152) : error C2601: 'class_0::getVitesse' : local function definitions are illegal
class_0.cpp(156) : error C2601: 'class_0::startBehavior' : local function definitions are illegal
class_0.cpp(162) : error C2601: 'class_0::getM_nSampleTime' : local function definitions are illegal
class_0.cpp(166) : error C2601: 'class_0::setM_nSampleTime' : local function definitions are illegal
class_0.cpp(170) : error C2601: 'class_0::initRelations' : local function definitions are illegal
class_0.cpp(176) : error C2601: 'class_0::initStatechart' : local function definitions are illegal
class_0.cpp(182) : error C2601: 'class_0::cancelTimeouts' : local function definitions are illegal
class_0.cpp(186) : error C2601: 'class_0::cancelTimeout' : local function definitions are illegal
class_0.cpp(196) : error C2601: 'class_0::rootState_entDef' : local function definitions are illegal
class_0.cpp(204) : error C2601: 'class_0::rootState_processEvent' : local function definitions are illegal
class_0.cpp(231) : fatal error C1004: unexpected end-of-file found
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

Build Done



 

Cause

Change in Simulink 2015 configuration. Note that this may occur if you have run the MATLAB "Embedded Coder Quick Start" tool on your simulink model as this makes several configuration changes to Simulink code generation that are not compatible with IBM Rational Rhapsody.

Resolving The Problem

1. Open the Simulink model
2. Click on 'Simulation->Model Configuration Parameters' menu item (on the Simulink model window)

3. In the appearing dialog, click on the 'Code Generation' section in the left pane
3.1. Make sure the 'System target file' is set to 'ert.tlc'
3.2 Optional, check the 'Generate code only' to avoid compilation of the code by Simulink.


4. Click on 'Code Generation->Interface'
4.1 Make sure the 'Code interface packaging' is set to 'Nonreusable function'
4.2 Make sure the 'Terminate function required' is set


5. Click on 'Code Generation->Symbols'
5.1. Make sure the 'Global variables' is set to '$R$N$M'
5.2 set the 'System-generated identifiers' to be 'Classic' (instead of 'Shortened')




     

6. Click on 'Solver' section and change the type to 'Fixed-Step'


7. Click on 'Apply', and generate the code. Note, the 'Generate Code' button is located in 'Code generation' section'.




     
8. Click 'OK', and save the Simulink model.

9. Continue with normal import procedure Importing Mathworks Simulink components > In Rational Rhapsody

[{"Line of Business":{"code":"LOB59","label":"Sustainability Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"ARM Category":[{"code":"a8m50000000CjWPAA0","label":"Rhapsody->Collaborations->Simulink"}],"ARM Case Number":"","Platform":[{"code":"PF033","label":"Windows"}],"Version":"All Version(s)"}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21977644