Jump to content
  • Advertisement
Sign in to follow this  
KenWill

C++ enum class error

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement

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*

Share this post


Link to post
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 this post


Link to post
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!