title: C++ - Error: 'list' does not name a type (list object as member variable in class)
body: <p>I have been running into the "'xxx' does not name a type" error a lot and most posts I've read before have mentioned that this error occurs with some dependency issues.  However, I can't seem to find mine.  Here's what I got:</p>
  
  <p><em>GameLib.h</em></p>
  
  <pre><code>#ifndef GAMELIB_H_
  #define GAMELIB_H_
  
  //Structures
  struct player_t {
      std::string name;
      int MMR;
  };
  
  //Prototypes
  void* queueUpPlayer(void*);
  int randomMMR();
  std::string randomName();
  
  #endif /* GAMELIB_H_ */
  </code></pre>
  
  <p><em>PlayerGroup.h</em></p>
  
  <pre><code>#ifndef GROUP_H_
  #define GROUP_H_
  
  class playerGroup {
  private:
      std::list&lt;player_t&gt; players;
      std::list&lt;player_t&gt;::iterator it;
      const int totalSize = 10;
  
  public:
      //Constructor
      playerGroup();
  
      //Destructor
      ~playerGroup();
  
      //Add
      void add(const player_t p);
  
      ....
  };
  
  #endif /* GROUP_H_ */
  </code></pre>
  
  <p><em>PlayerGroup.cpp</em></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;string&gt;
  #include &lt;cmath&gt;
  #include &lt;list&gt;
  
  #include "GameLib.h"
  #include "playerGroup.h"
  
  using namespace std;
  
  playerGroup::playerGroup() {}
  
  playerGroup::~playerGroup() {}
  
  void playerGroup::add(const player_t p) {
      if(players.size() &gt;= totalSize) exit(1);
      players.push_back(p);
  }
  
  .....
  </code></pre>
  
  <p>I'm recieving this error on both the lists member variables in the PlayerGroup class:</p>
  
  <pre><code>..\src\PlayerGroup.h:13:2: error: 'list' in namespace 'std' does not name a type
  ..\src\PlayerGroup.h:14:2: error: 'list' in namespace 'std' does not name a type
  </code></pre>
  
  <p>Thanks for all the help in advance!</p>