Why does Simulink code generator put #includes into my .c AND into the also #included .h?
조회 수: 4 (최근 30일)
이전 댓글 표시
I generate C code from a Simulink model. Since upgrading from 2021a to 2023b, I've noticed that Simulink redundantly #includes my _sharedutils headers containing function declarations both in myModelName.c AND in myModelName.h, even though it also #includes myModelName.h in myModelName.c.
Can anybody tell me why it would do that and how to make it stop?
댓글 수: 0
답변 (1개)
Infinite_king
2023년 12월 11일
편집: Infinite_king
2023년 12월 11일
Hi Simon Ahrens,
I understand that after upgrading to R2023b, C code generated from Simulink model contains unnecessary header files located in ‘my_sharedutils’ folder.
In Simulink, we can create models that can be reused in other models multiple times. Starting in R2022b, the code generator handles function and file packaging of generated code differently. For reusable library subsystems, the code generator produces subsystem code in the ‘slprj/target/_sharedutils’ folder. The subsystem code is shared across models as per model reference hierarchy.
This is indeed a valuable feature that helps minimize redundancy. You have the flexibility to control the names of functions, files, and the location of the shared library code, allowing you to customize it according to your needs. For more information on customization and setting up reusable library code, please refer to the following MATLAB documentation,
For more information on changes in each release, refer the following MATLAB documentation,
Hope this is helpful.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!