I wrote in C function:
void func(int count,bool infini){
//...
}
I try compil开发者_如何学编程e this code with Code Blocks, (GCC) spike:
"expected declaration specifiers or '...' before bool"
. Where is bug?
Chances are that you are compiling in C mode. C does not have bool
. Use int
instead or include stdbool.h
to get a #define
of bool
(only C99) or create a typedef / #define
yourself (if your compiler doesn't have or you don't want to use stdbool.h
. But GCC provides this header).
Alternatively in C99 code you can use _Bool
instead (which is a keyword in C99, much like bool
is to C++), but take in mind that C99 is not widely supported.
The bool
is in C++ but not in C.
精彩评论