• 9
• 9
• 9
• 10
• 10

# C++ enum class error

This topic is 900 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

enum class EnumClass1
{
VALUE1,
VALUE2,
VALUE3
};

enum class EnumClass2
{
VALUE1,
VALUE2,
VALUE3
};



My code looks pretty much like this, and i'm sure this is the right syntax yet i'm getting this error:

[attachment=29513:hasd.PNG]

My guess is that i cannot have multiple enum classes in the same file? I have no idea what is causing the error because i have used enums classes like this somewhere else with no problem whatsoever.

##### Share on other sites

Your code as posted compiles for me. You may want to post your actual code.

##### Share on other sites

Your code as posted compiles for me. You may want to post your actual code.



enum class Gender
{
MALE,
FEMALE

};

enum class SkinColor
{
BLACK,
WHITE

};

enum class Nationality
{
BRITISH,
AMERICAN,
RUSSIAN,
FRENCH,
ROMANIAN,
CHINESE,
JAPANESE,
INDIAN,
IRISH,
SCOTISH,
IRANIAN,
BRAZILIAN,
POLISH,
GERMAN,
MEXICAN,
ITALIAN,
SPANISH,
VIETNAMESE,
NORTH_KOREAN,
DANISH
};


My code. *ignore the content*

##### Share on other sites

My code. *ignore the content*

*** TRIGGERED ***

Nah, your problem most likely resides outside of the file. Check the actual file and line where the first error is occurring. If the code looks okay, then it's probably a missing semicolon from the file that included that one. Check there next.

##### Share on other sites

My code. *ignore the content*

*** TRIGGERED ***

Nah, your problem most likely resides outside of the file. Check the actual file and line where the first error is occurring. If the code looks okay, then it's probably a missing semicolon from the file that included that one. Check there next.

Yes it was, i'm sorry i didn't pay attention. There was an error in the file name itself, instead of .cpp it was .c.

Thanks a lot guys!

Edited by KenWill