I can’t figure out what the actual problem is with this.
typedef struct _actor
{
...
} _actor, Actor;
class Actor
{
...
};
I get this weird error message actor.cpp:31: error: using typedef-name ‘Actor’ after ‘class’.
Any idea what I did wrong here? Thank you 🙂
You are not allowed to define the symbol
Actormore than once. Thetypedefstatement already defines the symbolActoras an alias forstruct _actorbefore you attempt to declare a class with the same name.I’m guessing you’re using the
gcccompiler. I get the following errors when I compile withgcc:The first message (pointing the
class Actorline in the program) states that you cannot declare a class with atypedef-name(Actoris already declared usingtypedef). The second message (pointing to thetypedef struct _actorline in the program) is a little clearer and refers to the multiple declarations forActor.It is very common in C/C++ for a single class of error like this to result in multiple compiler errors and often the more helpful message is not the first reported.