Harvey Harvey - 17 days ago 11
C++ Question

Why do I get this compiler error?

I want to understand this error: syntax error before 'bool' ,on the following code:

typedef struct hdate{
date_arc_u date;
unsigned short time;
bool test;
}PACKED_ST horodate_a


When I change bool to another type there is no error.
I already use bool in others parts of the code without error.
I don't understand this error here ....
Anyone can help?

Answer

It's probably because you are writing C code, and the bool type does not exist in C. Your file extension is probably .c, not .cpp, and your code definitely looks like it was written in C.