Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7435137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:00:49+00:00 2026-05-29T10:00:49+00:00

I have enum declared in a header file called sm.h enum GameStates { STATE_NULL

  • 0

I have enum declared in a header file called “sm.h”

enum GameStates
{
  STATE_NULL = 0,
  STATE_INTRO,
  STATE_TITLE,
  STATE_MAIN,
  STATE_EXIT
};

All it does is list the possible game states

However in the following line in “base.cpp”:

stateID = STATE_INTRO;

The compiler says “STATE_INTRO was not declared in this scope”. I have no idea what I am doing wrong. I know that I have included the header file right and I can go to its deceleration from the .cpp file. So why am I getting this error.

stateID = STATE_INTRO;

Is used in:

bool baseFunctions::load_rc()
{
 stateID = STATE_INTRO;

 currentState = new Intro();

 return true;
}

which defines a class function in a header file.

There are no global conflicts because it is the only enum in the whole program

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:00:49+00:00Added an answer on May 29, 2026 at 10:00 am

    From your link to your files, you have the following in both sm.h and base.h

    #ifndef BASE_H_INCLUDED
    #define BASE_H_INCLUDED
    

    Change the one in sm.h to something like

    #ifndef SM_H_INCLUDED
    #define SM_H_INCLUDED
    

    and I expect you’ll be fine.

    As it is, base.cpp loads base.h, then when it gets to sm.h the #ifndef is false, so it excludes everything in sm.h.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an enum I have declared in some .h file: typedef enum {
In one header file, I have something like: // PasscodeInputViewController.h typedef enum { PasscodeInputModeOn,
I have a contant list declared in java using enum type, that must appears
Hi I have an enum declared like this: typedef enum { Top, Bottom, Center
I have the following enum declared: public enum TransactionTypeCode { Shipment = 'S', Receipt
I have declared an enum in my server code, and would like my client
In a header I have a setup like this namespace NS { typedef enum
If I have something like the following in a header file, how do I
I have an enum declared in my code as: enum REMOTE_CONN { REMOTE_CONN_DEFAULT =
i have a class and have declared an enum in it like public enum

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.