Why do I get 'identifier "single" is undefined' error when importing struct with 'single' elements using the 'Simulink.importExternalCTypes' function?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 11 Jul. 2022
Beantwortet: MathWorks Support Team
am 15 Sep. 2022
I have a ".h" file where I define custom data types. In it, I define struct types with elements of 'double' type and 'single' type. Then I use the 'Simulink.importExternalCTypes' function to generate Simulink representations of my custom data types. This is successful for the structs with 'double' elements, but for the structs with 'single' elements, I receive the error message below.
Error using Simulink.importExternalCTypes
Custom code parsing failed with the messages:
exampleTypes.h: error: identifier "single" is undefined.
Why am I experiencing this error message?
Akzeptierte Antwort
MathWorks Support Team
am 11 Jul. 2022
The syntax in C for a single precision floating type number is 'float.' The C 'float' type corresponds to the Simulink 'single' base data type. Changing the element definitions from 'single' to 'float' in 'exampleTypes.h' will resolve this error message.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Coder finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!