'rtmGetDataMapInfo': identifier not found

1 回表示 (過去 30 日間)
Alvar
Alvar 2025 年 6 月 23 日
回答済み: Deepak 2025 年 6 月 27 日
Hello,
I have to run a Simulink ERT simulation (based on simulink and custom code) which uses mex and the Real Time Coder. I did not program this simulation myself, so I'm not a big expert on it, but I need to get it to work - it used to work up to 2016b, but I don't know if it has been maintained since then.
My specific problem is that when the command for mex is run:
mex('-g',inc_strings{:},all_srcs{:},otherArgs{:},'-outdir',mexsim,'-output','SpheresMexSim');
I get errors that none of the "rtm" functions are found:
error C3861: 'rtmGetDataMapInfo': identifier not found
error C3861: 'rtmGetT': identifier not found
error C3861: 'rtmGetErrorStatus': identifier not found
error C3861: 'rtmGetStopRequested': identifier not found
The latest page on the Matlab website still says to use those functions, and that they are "built in":
However, the compiler is not able to find them.
Anyone has any idea of what changed since 2016 and 2025 that made these functions not be there by default? Do I need to #include anything in my code now? If so, what? (I could not find the functions in the source code myself, so far).
Thank you for any help!
Alvar
  1 件のコメント
Alvar
Alvar 2025 年 6 月 23 日
More searching on this, I ran into:
When I run the Matlab GRT example (ConfigurationRapidPrototypingInterface) it creates a ConfigurationRapidPrototypingInterface.h that does define the macros for the RTM functions (almost at the top, immediately after the includes).
But the .h created for my simulation does not create the rtm macros.
The simulation I use does need:
  • Modeling -> Parameters -> Code Interface -> Component -> Code interface packaging: C++ class
While the Matlab GRT example uses:
  • Component -> Nonreusable function
  • Subcomponent -> Reusable function
(I reviewed https://www.mathworks.com/help/rtw/ref/codeinterfacepackaging.html fully, but don't know why changing to C++ would no longer do the macros? I could not find a "change log" for this page where the behavior would have changed since Matlab 2016b).
Did the C++ interface stop creating the macros at some point? Is there any way around it?
Thank you again.
Alvar

サインインしてコメントする。

回答 (1 件)

Deepak
Deepak 2025 年 6 月 27 日
Hi Alvar,
In MATLAB R2025a, when you select the C++ class interface under Code Interface Packaging, Simulink generates a C++ class for your model and does not include the old C-style rtmGet... macros (e.g., rtmGetDataMapInfo, rtmGetT, etc.). These were part of the legacy C interface but are omitted in the C++ packaging, hence, you will see “identifier not found” compile errors.
To resolve this, you can try the following
  • Option 1: Switch the packaging to “Nonreusable function” (C interface) in the Configuration Parameters. Regenerate code and the rtmGet... macros will reappear.
  • Option 2: Stay with C++ but adapt your code to use the generated class methods for accessing model data and time. Also ensure the C API (data map) is enabled in the Code Generation settings and include the generated model header (e.g., model.h or .hpp).
Please find attached the relevant documentation for reference:
I hope this helps.

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by