Mex compiler used for referenced protected model
Show older comments
Hi,
I have a model ("Validation") referencing two protected (one of them "Aircraft_Model") models in accelerator mode.
On my PC this model is compiling without any problems, on my laptop however I get following error (so far only for one of the protected models).

With following parameter differences:
For all three models I have the same settings in Model Parameters -> Code Generation. Ert.tlc and MinGW64 as compiler.
Additionally, when typing 'mex -setup' in the command line, for PC and Laptop MinGW64 is set as a compiler for C and C++. And both use the same version and update of MATLAB.
I didn't find any helpful tips on the internet about solving this issue.
Does anyone has an idea how to solve the issue?
Thanks a lot,
Raphael
Answers (1)
Infinite_king
on 18 Dec 2023
0 votes
Hi Raphael Eckfeld,
I understand that you're having trouble generating a Mex file for a Simulink model that includes protected models.
The possible reason for this issue could be a misconfiguration of code generation settings. Follow the steps below to cross-check the model settings across different devices,
- Open your Simulink model.
- In the ‘MODELING’ tab, select ‘Model Settings’ option.
- In the "Code Generation" section, check the ‘Target selection’ and ‘Build Process’ settings.
- Check the ‘Toolchain’ and ‘Toolchain details’.
- Update the setting such that it was compatible with the device you are using.
- Click "Apply" and then "OK" to save the changes.
- Attempt to generate code again.
In addition, you can follow the below general troubleshooting steps,
- Ensure that the versions of MinGW64 on both systems match.
- Verify that the paths to MinGW64 are correctly set on both systems. Check the system path by typing getenv('PATH') in the MATLAB Command Window.
- Ensure that necessary environment variables, such as MW_MINGW64_LOC, are correctly set on both systems.
- Look for any MATLAB add-ons or toolboxes installed on your PC that might be relevant to the compilation process. Check if your laptop is missing a specific toolbox or add-on that the model references.
- Clear temporary files in MATLAB using the clear and clear mex commands in the Command Window.
For more information, refer the following MATLAB documentation,
- https://www.mathworks.com/matlabcentral/answers/313298-i-already-have-mingw-on-my-computer-how-do-i-configure-it-to-work-with-matlab
- https://www.mathworks.com/matlabcentral/answers/417590-why-clear-mex-needed
- https://www.mathworks.com/help/simulink/slref/protected-models-for-model-reference.html
Hope this is helpful.
Categories
Find more on MATLAB Support for MinGW-w64 C/C++ Compiler 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!