Reputation: 602
I have this typedef:
//MyClass_1.h
typedef enum
{
edit,
copy,
paste
} textAction;
and when I want this typedef in MyClass_2.h:
//MyClass_2.h
typedef enum
{
edit,
copy,
paste
} textAction;
I have error: Typedef redefinition with types ('enum textAction' vs 'enum textAction'). In MyClass_2.h I didn't use #import MyClass_2!!! Why I have this mistake?
Upvotes: 0
Views: 661
Reputation: 2098
use the same enum in both classes. put the enum in a .h file and include it in both other .h this way the exact same enum is prepared for the compiler.
the way you use it, it is 2 different (but same looking) enums for the linker/compiler and stuff.
Upvotes: 2