Behebung von C-Fehler: unknown type name 'bool'
English
Deutsch
Problem:
Du hast C-Code wie
main.c
bool mybool;aber wenn du versuchst, es zu kompilieren, siehst du eine Fehlermeldung wie
unknown_type_bool_output.txt
main.c: In function ‘main’:
main.c:3:5: error: unknown type name ‘bool’; did you mean ‘_Bool’?
bool mybool;
^~~~
_BoolLösung
Add
main_fixed.c
#include <stdbool.h>am Anfang der Quelldatei, wo der Fehler aufgetreten ist.
Der Grund für diesen Fehler ist, dass bool kein Standardtyp in C ist (wie int oder char), sondern nur in stdbool.h.
Check out similar posts by category:
C/C++, GCC Errors
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow