Remove this "
typedef
" and you will be fine. :-)
[EDIT #1]
Why are you writing something which you do not understand. Your
typedef
does not define a type, it simply introduces a new name for the type, an alias:
typedef type_definition new_alias_name_for_this_type
typedef int my_integer_type_I_want_to_use;
After you do it, you can use
my_integer_type_I_want_to_use
instead of
int
; and the purpose if this is: you can quickly change your decision to use
int
. For example, if you decide to use
unsigned int
instead, it can be done in one line where you define
my_integer_type_I_want_to_use
.
In your case,
enum MyType { A, B }
is already a complete type definition. If you use
typedef
before it (you could, but why?), this constructs needs an alias type name at the end, which is missing. Is it clear now?
Please see:
http://en.wikipedia.org/wiki/Typedef[
^].
[EDIT #2]
Original question was about
enum
declaration: OP tried to define it with redundant
typedef
before
enum
. After my first answer, the question was changed.
—SA