Code generation fails with PLCnext Target for Simulink: pxc_plcn_make_rtw_hook error "Unrecognized method, property, or field 'Identifier' for class 'MException'"
Show older comments
I am trying to generate code from a Simulink model using PLCnext Target for Simulink.
The model runs correctly in simulation, but code generation fails during the build process.
The build stops with the following error:
The call to pxc_plcn_make_rtw_hook, during the exit hook generated the following error:
Unrecognized method, property, or field 'Identifier' for class 'MException'.
The build process will terminate as a result.
Caused by:
Unrecognized method, property, or field 'Identifier' for class 'MException'.
This happens when runs “generate code”
Model configuration:
- System target file: pxc_plcn.tlc
- Template makefile: pxc_plcn.tmf
- Generate code only: enabled
- Language: C++
The error appears in the pxc_plcn_make_rtw_hook during the exit hook phase.
Is this related to an incompatibility between the PLCnext Target for Simulink and the MATLAB version, or is there a known issue with this hook?
Answers (1)
Adarsh
on 10 Apr 2026 at 6:02
0 votes
As per my understanding you are encountering an error during code generation from a Simulink model using "PLCnext Target for Simulink". The build fails in the exit hook with the error "Unrecognized method, property, or field 'Identifier' for class 'MException'.".
It looks like the issue is in the "pxc_plcn_make_rtw_hook" file where the MException object property is being accessed as "Identifier" instead of "identifier" (with a lowercase 'i').
MATLAB property names are case-sensitive and the correct property name is 'identifier'.
Modifying this hook file to use the correct property name will resolve this issue as of now.
Locate the hook file on your system and open the file and search for any instance of "Identifier" being accessed on a MException object and change all occurances to lowercase.
For more information on MException the following documentation link can be referred:
I hope this helps!
Categories
Find more on Deployment, Integration, and Supported Hardware 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!