troubleshooting Question

Enumerations problem

Avatar of IssacJones
IssacJones asked on
System Programming
18 Comments2 Solutions233 ViewsLast Modified:

I have a enumeration defined in a header file e.g.

enum HelloGoodbye {HELLO, GOODBYE};

I have also created a function which returns this enumeration e.g.

HelloGoodbye MyClass::SaySomething(void)
    return GOODBYE;

This works but when I try something like

void MyOtherClass::DoSomething(void)
    switch (SaySomething){
       case GOODBYE:
       case HELLO:

I get the following compile error:

Error      1      error C2065: 'GOODBYE' : undeclared identifier

I have added an include in this file so the enumeration is read so I can't quite see what I'm doing wrong.

Can anybody help?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros