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:
- C++ —Return multiple values of different types
- Springboot integration redis reports non null key required (solved)
- About java “Error: bad binary operator types”
- Difference between isempty method and isblank method in stringutils
- C++: terminate called after throwing an instance of ‘std::length_error‘ (sort function cmp sorting rules problem)
- Binary tree traversal (preorder, middle order, postorder, hierarchy traversal, depth first, breadth first)
- Determine whether the list is empty isempty
- Leetcode-234: palindrome linked list
- Java long type error: error: integer number too large
- C + +: error in X utility file
- JavaScript summary: the difference between typeof and instanceof, and Object.prototype.toString() method
- The differences between the equals method in the string class and the equals method in the object class
- Lock wait timeout exceeded — transaction and index
- Pit encountered by entity class data type BigDecimal
- Inconsistency between adapter data and UI data after dragging recyclerview (data disorder)
- Implement Set using Array.
- [PHP]stream_socket_client(): Failed to enable crypto
- Override the equals method and override the toString method
- Empty Matrices, Scalars, and Vectors
- check a tree is balanced or not