'rtmGetDataMapInfo': identifier not found
Show older comments
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
Answers (1)
Deepak
on 27 Jun 2025
0 votes
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.
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!