Troubleshooting
Problem
When you export a model to simulink, if the model contains sub/nested blocks with Activity Diagrams, the compiler reports multiple linker errors.
[]error LNK2019: unresolved external symbol "public: virtual __cdecl OMActivityManager::~OMActivityManager(void)" (??1OMActivityManager@@UEAA@XZ)
error LNK2019: unresolved external symbol "public: virtual __cdecl OMActivityContext::~OMActivityContext(void)" (??1OMActivityContext@@UEAA@XZ)
error LNK2001: unresolved external symbol "public: virtual void __cdecl OMActivityNode::connectOutputFlow(class OMActivityEdge &)"
error LNK2001: unresolved external symbol "public: virtual void __cdecl OMAction::visit(void)" (?visit@OMAction@@UEAAXXZ)[
]
Cause
A structure with nested blocks/classes where a lower level block/class has an activity diagram:
![](/support/pages/system/files/support/swg/rattech.nsf/0/169bafd4ee28c9fb85258288003bad36/Cause/0.23A.jpg)
Rhapsody Activity Diagrams are located in a separate section of the Object Execution Framework (OXF). With the above model it may be necessary to explicitly add this library to the MATLAB build script.
Resolving The Problem
As well as generating the project source code, Rhapsody also generates a MATLAB script which tells MATLAB Simulink how to build the project source code. This script is based on several templates located in the <RhapsodyShare>/etc/S_FunctionTemplates directory. There are different scripts for language (C/C++) and export action (Export and Export with Animation):
A. Simulink Export:
1) open <RhapsodyShare>/etc/S-FunctionTemplates/C++/build_sfunction_tmpl.m
2) Before, the $(WinmmLib) line add "$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxsim$(LibExtension)"
For example:
mex
$(CompileSwitches)
COMPFLAGS="$COMPFLAGS $(LIBCRT_FLAG)"
-D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
-I.
-I"$(OMROOT)/LangCpp"
-I"$(OMROOT)/LangCpp/oxf"
-I"$(AdaptorSearchPath)"
-I"$(OMROOT)/Profiles/Simulink"
$(SourceFiles)
"$(OMROOT)/LangCpp/oxf/OMSFunctionTimer.cpp"
"$(OMROOT)/LangCpp/oxf/OMSFunctionTimerFactory.cpp"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxf$(LibExtension)"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxsim$(LibExtension)"
$(WinmmLib)
$(WebifyLibs)
B. Simulink Export with Animation:
1) open <RhapsodyShare>/etc/S-FunctionTemplates/C++/build_sfunction_tmpl_anim.m
2) Before, the $(SocketLib) line add "$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxsiminst$(LibExtension)"
for example:
mex
$(CompileSwitches)
COMPFLAGS="$COMPFLAGS $(LIBCRT_FLAG)"
-D_OMINSTRUMENT
-DOM_WITH_CLEANUP
-D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
$(LinkerFlags)
-I.
-I"$(OMROOT)/LangCpp"
-I"$(OMROOT)/LangCpp/oxf"
-I"$(AdaptorSearchPath)"
-I"$(OMROOT)/LangCpp/aom"
-I"$(OMROOT)/LangCpp/tom"
-I"$(OMROOT)/Profiles/Simulink"
$(SourceFiles)
"$(OMROOT)/LangCpp/oxf/OMSFunctionTimer.cpp"
"$(OMROOT)/LangCpp/oxf/OMSFunctionTimerFactory.cpp"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxfinst$(LibExtension)"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)aomanim$(LibExtension)"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)omComAppl$(LibExtension)"
"$(OMROOT)/LangCpp/lib/$(LIB_PREFIX)oxsiminst$(LibExtension)"
$(SocketLib)
$(WinmmLib)
$(WebifyLibs)
The same instructions should be applied to the <RhapsodyShare>/etc/S_FunctionTemplates/C templates if C is the language being used.
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg22016240