Error description
unknown type name ‘bool’
Recently, using C to implement data structure encountered the following error
➜ LinkedList gcc list.c
list.c:14:1: error: unknown type name ‘bool’; did you mean ‘_Bool’?
bool is_empty(PNODE pHead);
^~~~
_Bool
list.c:77:1: error: unknown type name ‘bool’; did you mean ‘_Bool’?
bool is_empty(PNODE pHead)
^~~~
_Bool
list.c: In function ‘is_empty’:
list.c:80:9: error: ‘true’ undeclared (first use in this function); did you mean ‘free’?
return true;
^~~~
free
list.c:80:9: note: each undeclared identifier is reported only once for each function it appears in
list.c:82:9: error: ‘false’ undeclared (first use in this function); did you mean ‘fclose’?
return false;
^~~~~
Error reason
Unknown type name: ‘bool’, because there is no boolean type defined in the C language standard (C89), an error will be reported. C99 provides a header file & lt; stdbool.h> Code> defines
bool
, true
represents 1 and false
represents 0. As long as you import stdpool. H
, you can easily operate Boolean types.
resolvent
#include <stdbool.h>
"21442;" 32771;"38142;" 25509
https://www.jianshu.com/p/aa951e784e96
Read More:
- Linux GCC compilation error: “collect2: LD returned 1 exit status”
- [solution] warning: this statement may fall through [- wimplicit fallthrough]) encountered during GCC compilation
- ValueError: Unknown label type: ‘unknown‘
- configure:3855: gcc -V >&5 gcc: error: unrecognized command line option ‘-V’
- Installing GCC reduced version GCC 4.4.6 under Linux
- Gcc compiler warning solution: “extra tokens at end of ifndef directive” Tags: GCC, warning
- error: unknown type name ‘Q_DECLARE_METATYPE‘
- error C2784: ‘bool std::operator <(const std::_Tre
- Error in data training: valueerror: unknown label type: ‘continuous‘
- Start react-native after updating Xcode11 and report an error: Unknown argument type ‘_attribute_’ in method -[RCTAppState getCurren
- Python AttributeError: ‘bool‘ object has no attribute ‘ui‘
- Error in machine learning training data (FIT): valuee rror:Unknown label type:‘continuous‘
- urlopen error unknown url type:httpë/HTTP Error 400:Bad Request
- PyTorch – AttributeError: ‘bool‘ object has no attribute ‘sum‘
- Solutions to error c2143: syntax error: missing ‘;’ before ‘type’ in C + + program compilation
- Idea ignores compilation errors and runs in eclipse compilation mode
- caffe deep learning [three] compilation error: fatal error: hdf5.h: No such file or directory compilation terminated.
- PHP error Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error:
- The problem of strncpy and the solution of GCC compile time checking
- Error tips:array type has incomplete element type