title: is not a class or namespace name
body: <p>I know this question has been asked and answered before, but none of the solutions seem to have worked for me, and my compiler is acting really weird with this error.</p>
  
  <p>When I try and compile my code I get numerous errors such as these:</p>
  
  <pre><code>Error   1   error C2653: 'TargetList' : is not a class or namespace name    c:\projects\arcturus\augmentedreality\targetlist.cpp    5   1   AugmentedReality
  Error   2   error C2065: 'Target' : undeclared identifier   c:\projects\arcturus\augmentedreality\targetlist.cpp    5   1   AugmentedReality
  Error   3   error C2146: syntax error : missing ')' before identifier 'target'  c:\projects\arcturus\augmentedreality\targetlist.cpp    5   1   AugmentedReality
  Error   4   error C2059: syntax error : ')' c:\projects\arcturus\augmentedreality\targetlist.cpp    5   1   AugmentedReality
  Error   5   error C2143: syntax error : missing ';' before '{'  c:\projects\arcturus\augmentedreality\targetlist.cpp    6   1   AugmentedReality
  Error   6   error C2447: '{' : missing function header (old-style formal list?) c:\projects\arcturus\augmentedreality\targetlist.cpp    6   1   AugmentedReality
  </code></pre>
  
  <p>I encountered this kind of error when compiling my project before, but it mystically disappeared. I was trying to fix the problem, and after a while it just started to work again after I reverted all of my changes.</p>
  
  <p>I think this may be a problem with my precompiled header, as this error popped up after I had tried to fix an error with my PCH not working properly.</p>
  
  <p>Here is my code (and I know it isn't that well designed, just trying to get it to work at the moment :P):</p>
  
  <p><strong>StdAfx.h</strong></p>
  
  <pre><code>#pragma once
  
  #define _USE_MATH_DEFINES
  #include &lt;math.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  </code></pre>
  
  <p><strong>Target.h</strong></p>
  
  <pre><code>#pragma once
  
  #include "Position.h"
  #include &lt;string&gt;
  #include &lt;vector&gt;
  
  class Target
  {
  public:
      Target();
      Target(std::string shortName, std::string longName, Position position);
      ~Target();
  
      bool UpdateTargetData(Position currentPosition);
  
      std::string mShortName;
      std::string mLongName;
      Position mPosition;
      double mDistance;
      double mHorizontalBearing;
      double mVerticalBearing;
  };
  </code></pre>
  
  <p><strong>Target.cpp</strong></p>
  
  <pre><code>#include "Target.h"
  #include "stdafx.h"
  
  bool Target::UpdateTargetData(Position currentPosition)
  {
      mDistance = currentPosition.GetDistance(mPosition);
      mHorizontalBearing = currentPosition.GetHorizontalBearing(mPosition);
      mVerticalBearing = currentPosition.GetVerticalBearing(mPosition);
  
      return true;
  }
  </code></pre>
  
  <p><strong>TargetList.h</strong></p>
  
  <pre><code>#pragma once
  
  #include "Target.h"
  
  class TargetList
  {
  public:
      TargetList();
      ~TargetList();
  
      bool AddTarget(Target target);
      bool GetTarget(std::string shortName, Target&amp; returnTarget);
      bool RemoveTarget(std::string shortName);
  
  private:
      std::vector&lt;Target&gt; mTargets;
  };
  </code></pre>
  
  <p><strong>TargetList.cpp</strong></p>
  
  <pre><code>#include "TargetList.h"
  #include "Target.h"
  #include "stdafx.h"
  
  bool TargetList::AddTarget(Target target)
  {
      if (GetTarget(target.mShortName, Target()) != false)
      {
          mTargets.push_back(target);
          return true;
      }
  
      return false;
  }
  
  bool TargetList::GetTarget(std::string shortName, Target&amp; returnTarget)
  {
      std::vector&lt;Target&gt;::iterator iterator;
  
      for (iterator = mTargets.begin(); iterator &lt; mTargets.end(); iterator++)
      {
          if ((*iterator).mShortName == shortName)
          {
              returnTarget = (*iterator);
              return true;
          }
      }
  
      return false;
  }
  
  bool TargetList::RemoveTarget(std::string shortName)
  {
      std::vector&lt;Target&gt;::iterator iterator;
  
      for (iterator = mTargets.begin(); iterator &lt; mTargets.end(); iterator++)
      {
          if ((*iterator).mShortName == shortName)
          {
              mTargets.erase(iterator);
              return true;
          }
      }
  
      return false;
  }
  </code></pre>