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 8062257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:36:25+00:00 2026-06-05T10:36:25+00:00

class Game { public: static void Start(); private: static bool IsExiting(); static void GameLoop();

  • 0
class Game
{
public:
    static void Start();

private:
    static bool IsExiting();
    static void GameLoop();

    static void ShowSplashScreen();
    static void ShowMenu();

    enum GameState { Uninitialized, ShowingSplash, Paused,
                    ShowingMenu, Playing, Exiting };

    Game::GameState Game::_gameState = Game::Uninitialized;
    static sf::RenderWindow _mainWindow;
};
Game::GameState Game::_gameState;
RenderWindow Game::_mainWindow;

Error is now in function that runs first

void processEvents(){// error: first defined here ???
    Event event;
    while(App.pollEvent(event)){
        if(event.type == Event::Closed)
                App.close();
    }
}

And there are also other error such as multiple definition of `Game::_gameState’ in function it gives the same errors in other functions that are declared in Game class

void Game::Start(void) { // multiple definition of `Game::_gameState'
    if (_gameState != Uninitialized)
        return;

    _mainWindow.create(VideoMode(1200, 900, 32), "Game",
            Style::Close);
    _gameState = Game::ShowingSplash;

    while (!IsExiting()) {
        GameLoop();
    }

    _mainWindow.close();
}

I fixed the errors but one more showed up

while (!IsExiting()) {  //undefined reference to Game::IsExiting
    GameLoop();
}

_mainWindow.close();

}

I don’t know it is static bool function other functions works fine but this one is bool and gives me errors

  • 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-06-05T10:36:26+00:00Added an answer on June 5, 2026 at 10:36 am

    Because the enum GameState is contained within class Game you need to scope the variable accordingly:

    Game::GameState Game::_gameState;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class Game { public Game( boolean createstage, //For sorting purposes int slength, int
I have a class with the following declaration of the fields: public class Game
I have XNA game and it contains these classes public partial class Bird :
I defined the following Sound Class to play Sound in my Pacman Game: public
I am making a card game in ruby. I have the Game class, which
I renamed the class classBattle to Game and not I get Unable to load
A brief preface: I'm in a game design class where our project for the
My current class is planning on creating a basic networked game, but we have
#admin.py class GameListAdmin(admin.ModelAdmin): list_display = ['game', 'position'] ordering = ('position',) class GameAdmin(admin.ModelAdmin): list_display =
I am making a game for my CS class and the sprites I have

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.