In a header I have a setup like this
namespace NS {
typedef enum { GOOD, BAD, UGLY }enum_thing;
class Thing {
void thing(enum_thing elem);
}
}
and of course another cpp file that goes along with that header. Then I have a thread cpp file that contains main(). In this cpp file I use that enum to pass to the method thing().
using namespace NS;
int main() {
Thing t();
t.thing(BAD);
}
and of course I get other errors from G++ saying BAD was not declared. Any help on how I could overcome this error?
Thing t;notThing t()public:is missing before the method and a;is missing at the end of the class declaration, after the closing}.NS::BAD. Older compiler dislike this. typedefing in C++ is not needed in such cases. Here an anonymous enum is getting typedef'ed.