I have the following code in a header file:
enum {false,true};
and I have my main function in main.c. if I change the extention to main.cpp I get the following error:
Error C2059: syntax error 'constant'
Im using visual c++, any Idea why`?
true
and false
are keywords representing constant values in C++. You cannot use them to name things such as enum values.
As an example, the following would compile
enum { false_, true_ };
int main() {}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With