title: Unknown type name in C++
body: <p>I keep getting &quot;Unknown type name '<code>Life</code>'&quot; in <code>world.h</code> and &quot;Unknown type name '<code>Life</code>'&quot; and &quot;Unknown type name '<code>World</code>'&quot; in <code>game.h</code>.</p>
  <p>I have a feeling that there might be too many include statements based on other posts but I can't find the solution in this case.</p>
  <p>Any help/hints will be greatly appreciated</p>
  <p>game.h</p>
  <pre><code>#pragma once
  
  #ifndef LIFE_H
  #include &quot;life.h&quot;
  #define LIFE_H
  #endif
  
  #ifndef WORLD_H
  #include &quot;world.h&quot;
  #define WORLD_H
  #endif
  
  
  class Game {
  public:
      // Constructor/destructor
      Game(Life **life, int numLife);
      ~Game();
  
      void game_loop();
  private:
      World * m_world;
      int m_steps;
      bool m_automate;
  };
  </code></pre>
  <p>world.h</p>
  <pre><code>#pragma once
  
  #ifndef LIFE_H
      #include &quot;life.h&quot;
      #define LIFE_H
  #endif
  
  #ifndef WORLD_H
      #include &quot;world.h&quot;
      #define WORLD_H
  #endif
  
  class World {
  public:
      // Constructor/destructor
      World();
      ~World();
  
      void print() const;
  
      bool initLife(Life *life);
      void updateWorld();
  private:
  
      char getNextState(char state, char row, char col, bool toggle) const;
  
      char **m_grid_1;
      char **m_grid_2;
      bool m_toggle;
  };
  </code></pre>
  <p>life.h (without any errors)</p>
  <pre><code>#ifndef life_h
  #define life_h
  
  #ifndef life_h
      #include &quot;life.h&quot;
      #define life_h
  #endif
  
  #ifndef GAME_H
      #include &quot;game.h&quot;
      #define GAME_H
  #endif
  
  class Life {
  public:
  
      int getCol() const; // const member functions cannot modify member variables.
      int getRow() const;
      int getHeight() const;
      int getWidth() const;
      char getFromFigure(int r, int c) const;
  
  protected:
      int m_col;
      int m_row;
      int m_height;
      int m_width;
      char **m_sprite;
      World *m_world;
  };
  #endif
  </code></pre>