Why Embedded coder generates include to standard C library (<stddef.h> and <string.h>)? How to remove theese includes?
Ältere Kommentare anzeigen
I am using 2014b version. I need to integrate the generated code in an embedded SW, and I don't want to have external standard library include. When I generate the code, I have always in model.h generate file : #include stddef.h #include string.h
How to remove theese includes? I understand that they are needed for the initialization function (use of "memset" and "NULL").
I need to keep the I/O and datas initialization without having external includes. Thank you for you're help
Antworten (3)
User_in_Gim
am 24 Mär. 2017
Bearbeitet: User_in_Gim
am 24 Mär. 2017
I know it's an old question, but I faced with this problem 2 days ago. When I wanted to generate my simulink model with ert target, I had external standard librairies stddef.h and string.h included.
To solve this, I have to go in the Model Configuration Parameters Panel > Optimisation then check boxes :
* Remove root level I/O zero initialization
* Remove internal data zero initialization
and uncheck the box
* Use memset to initialize floats and double to 0.0
Now, I have no more librairies stddef.h and string.h included, Null or memset and rtmSetErrorStatus functions.
This was working for me and I hope it will help someone with the same problem.
1 Kommentar
Sabarirajan
am 19 Jun. 2020
Hi, I did the configuration but stil I'm getting stddef.h included in main.
Is any block can create this library ?
How to check in which line of code or block is reqesting this stddef.h file
Mike Hosea
am 18 Okt. 2014
Bearbeitet: Mike Hosea
am 18 Okt. 2014
1 Stimme
I know next to nothing about it, but perhaps use the CRL (Code Replacement Library) to replace the standard memset with one that you will provide, perhaps replace the NULL definition as well. Not sure.
Hopefully somebody will happen along with more information.
mahmoud yahia
am 30 Jan. 2022
1 Stimme
to remove the stddef.h include, you need to check this option under (Code Generation/Interface)

this will remove the error status function used in the initialization, it requires (NULL) definition.
for string.h, i can't find a more elegant way ither than using code replacement library and defineing your own memset.
1 Kommentar
ming
am 23 Mär. 2026 um 8:48
yes, "code interface packageing -uncheckerror status field in real-time model data structure" is only way to remove stddef.h. It is proved.
Kategorien
Mehr zu Deployment, Integration, and Supported Hardware finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!