title: c++ error: "undeclared identifier" when trying to make object. header issue?
body: <p>I guess I'm doing something wrong with my includes but I just can't seem to find what it is I am doing wrong. I am using visual studio 10 on a w7 64 bit system. </p>
  
  <p>The compile errors I get:</p>
  
  <pre><code>testd.cpp(9): warning C4018: '&lt;' : signed/unsigned mismatch
  testd.cpp(21): warning C4018: '&lt;' : signed/unsigned mismatch
  testd.cpp(36): error C2065: 'tmp' : undeclared identifier
  testd.cpp(37): error C2065: 'tmp' : undeclared identifier
  testd.cpp(37): error C2227: left of '-&gt;getTestId' must point to class/struct/union/generic type
  type is ''unknown-type''
  testd.cpp(40): error C2065: 'tmp' : undeclared identifier
  testd.cpp(41): error C2065: 'tmp' : undeclared identifier
  </code></pre>
  
  <p>So every time I am trying to make a new object (tmp) , he says "undeclared identifier".
  My guess is that he can't get to the class definition of Test (aldho he doesn't warn me),
  but I don't get why that is.. I reduced my code to a minimum, so that only the errorfunctions remain. Thanks in advance for your time</p>
  
  <p><em>test.h: definition of a class Test, with 2 atributes, getters, setters, constructors and a destructor</em></p>
  
  <pre><code>#pragma once
  class Test
  {
  private:
      int myTestId;
      string myTestNaam;    
  public:
      Test();
      Test(string TestNaam,int TestId);
      ~Test();
      int getTestId();
      string getTestNaam();
      void setTestId(int TestId);
  };
  </code></pre>
  
  <p>*test.cpp: definition of the functions for class Test</p>
  
  <pre><code>#include "stdafx.h"
  #include "headers/Test.h"
  Test::Test() {setTestId(0);}
  Test::Test(string TestNaam, int TestId) {setTestId(TestId);}
  Test::~Test() {}    
  void Test::setTestId(int TestId) {myTestId=TestId;}
  int Test::getTestId() {return myTestId;}
  </code></pre>
  
  <p><em>testd.h: definition of a class Testd, with static vector, and static functions</em></p>
  
  <pre><code>#pragma once
  #include "Test.h"
  class TestD
  {
  private:
      static vector&lt;Test*&gt; Testen;
      static int getPosition(int ID);
  public:
      static Test* newTest(Test*);
      static Test* getTest(int ID);
  };
  </code></pre>
  
  <p><em>testd.cpp: definition of the functions for class Testd</em></p>
  
  <pre><code>#include "StdAfx.h"
  #include "headers/Test.h"
  #include "headers/Testd.h"
  vector&lt;Test*&gt; TestD::Testen = vector&lt;Test*&gt;();
  Test* TestD::getTest(int ID)
  {for(int i =0; i &lt; Testen.size(); i++)
      {Test* tmp = Testen.at(i);
      if(tmp-&gt;getTestId() == ID)
      return tmp;
  }
  return 0;
  }
  
  int TestD::getPosition(int ID)
  {for(int i = 0; i &lt; Testen.size(); i++)
      {Test* tmp = Testen.at(i);
      if(tmp-&gt;getTestId() == ID)
      return i;
  }
  return -1;
  }
  
  Test* TestD::newTest(Test* Test)
  {if(Test-&gt;getTestId()==-1)
      {Test* tmp = Testen.at(Testen.size()-1);
      int newId = tmp-&gt;getTestId()+1;
      Test-&gt;setTestId(newId);
      }
      Test* tmp = getTest(Test-&gt;getTestId());
      if(tmp==0)
  {Testen.push_back(Test);
      return Test;
  }
  }
  </code></pre>
  
  <p>Finally i include my Stdafx.h</p>
  
  <pre><code>#pragma once
  #include "targetver.h"
  #include &lt;stdio.h&gt;
  #include &lt;tchar.h&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  #include &lt;string&gt;
  using namespace std;
  //some includes are not used in the files I mentioned here, but other files need them
  </code></pre>
  
  <p>Thanks for your help and i hope I didn't offend you by my poor English.</p>