c++ - Error C2059: syntax error 'constant' -


this question has answer here:

i have following code in header file:

enum {false,true}; 

and have main function in main.c. if change extention main.cpp following error:

error c2059: syntax error 'constant'  

im using visual c++, idea why`?

true , false keywords representing constant values in c++. cannot use them name things such enum values.

as example, following compile

enum { false_, true_ };  int main() {} 

Comments