C++ enum class error

Started by
3 comments, last by KenWill 8 years, 6 months ago

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.

Advertisement

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

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,
        CANADIAN,
        IRANIAN,
        BRAZILIAN,
        POLISH,
        GERMAN,
        MEXICAN,
        ITALIAN,
        SPANISH,
        VIETNAMESE,
        NORTH_KOREAN,
        DANISH
};

My code. *ignore the content*

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.

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!

This topic is closed to new replies.

Advertisement