title: Defining static variable of enum type in c++
body: <pre><code>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;
  </code></pre>
  
  <p>Error is now in function that runs first </p>
  
  <pre><code>void processEvents(){// error: first defined here ???
      Event event;
      while(App.pollEvent(event)){
          if(event.type == Event::Closed)
                  App.close();
      }
  }
  </code></pre>
  
  <p>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</p>
  
  <pre><code>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();
  }
  </code></pre>
  
  <p>I fixed the errors but one more showed up</p>
  
  <pre><code>while (!IsExiting()) {  //undefined reference to Game::IsExiting
      GameLoop();
  }
  
  _mainWindow.close();
  </code></pre>
  
  <p>}</p>
  
  <p>I don't know it is static bool function other functions works fine but this one is bool and gives me errors</p>