Undefined identifier when using LibMdlStartCustomCode

4 次查看(过去 30 天)
Hi,
I'm using the function LibMdlStartCustomCode in a tlc file:
%<LibMdlStartCustomCode("aaa","trailer")>
However, I obtain the following error message at code generation:
Error: File: C:\Program Files\MATLAB\R2021b\rtw\c\tlc\mw\hookslib.tlc Line: 320 Column: 22
Undefined identifier System
Main program:
==> [00] C:\Program Files\MATLAB\R2021b\rtw\c\tlc\mw\hookslib.tlc:LibMdlStartCustomCode(320)
do anyone have an idea what is going on ?

回答(1 个)

Kausthub
Kausthub 2023-10-6
Hi Stéphane,
I understand that you are facing an error while generating code using a custom TLC file which contains the LibMdlStartCustomCodefunction.
The provided error message tells us that the identifier “System” is undefined (https://www.mathworks.com/help/rtw/tlc/tlc-error-messages.html). You get this error because System is not part of CompiledModel" which means that “System” is missing from your model.rtw file.
Some points to be noted:
  • “System” is defined in the “model.rtw file and does not require any additional assignment in the TLC file.
  • Please verify whether “System” is defined in the “model.rtw" file and check whether NumSystems” is greater than 0.
  • There is one “System” for each nonvirtual subsystem in your Simulink model. So, please ensure that your model contains at least one nonvirtual subsystem.
Here are few resources that might give a better understanding of the issue:
Hope this helps and solves your error!

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by