Hi, I have defined enum in struct as /*************************************/ struct info { eunm { left, right} rotate; int val; }; int main() { struct info i; i.rotate = right; ... return 1; } /************************************/ while compiling this program, it is giving me an error H:\naveen\try\main.cpp(76) : error C2065: 'RIGHT' : undeclared identifier H:\naveen\try\main.cpp(76) : error C2440: '=' : cannot convert from 'int' to 'enum tree_rotation_info::rotation' Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast) H:\naveen\try\main.cpp(81) : error C2065: 'LEFT' : undeclared identifier H:\naveen\try\main.cpp(81) : error C2440: '=' : cannot convert from 'int' to 'enum tree_rotation_info::rotation' Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast) could u plz explain me about this error thanks in advance
What compiler and language are you using (language doesn't necessarily follow)? The following compiled perfectly in Visual Studio 2005: Code: void struct_test() { struct info { enum { left, right} rotate; int val; }; struct info i; i.rotate=info::right; }