Clear Filters
Clear Filters

Codegeneration of a harness model with multiple referenced models using a library block/chart with exported functions causes build error function is already defined

3 views (last 30 days)
I have a model which contains 2 different referenced models. Both models refer to a library block/chart which has a graphical function on its top level. The graphical function is exported ('Export chart level functions'), but not globally visible.
When generating code with GRT, codegeneration is succesfull, but the build fails. It mentions the exported function is already defined in the other model, which is true.
I would have expected because both models are in a harness, it would assign unique names to the exported functions, like it actually did to the header and source files. (ALM_Chk and ALM_Col).
How can I make sure there is a unique name generated for the exported functions in each referenced model to avoid a conflict during buildig?
Thank you in advance!

Answers (1)

Infinite_king on 26 Mar 2024
Edited: Infinite_king on 28 Mar 2024
Hi Karel Viaene,
I understand that your model is referencing 2 other models which uses the same library block. When attempting to generate the executable, the code is successfully generated but the project fails to build.
I suggest you follow the troubleshooting steps below:
  1. Verify if the model is properly configured for code generation.
  2. Review the limitations of code generation for referenced models at,
  3. Check the code generation parameters in the configuration. You can access the code generation settings through the 'C Code' tab.
  4. Create 2 subsystems from which you can reference the models.
  5. If the issue persists, consider contacting MathWorks technical support at


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!