Harvey Harvey - 1 year ago 107
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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download