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

1 次查看(过去 30 天)
Hello,
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!
Kr,
Brecht

回答(1 个)

Infinite_king
Infinite_king 2024-3-26
编辑:Infinite_king 2024-3-28
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, https://www.mathworks.com/help/rtw/ug/code-generation-limitations-for-model-reference.html
  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 https://www.mathworks.com/support/contact_us.html

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by