title: When I split up my C++ class into a header and implementation I get 20 compiler errors which don't make sense
body: <p>I was splitting up my program into a header and implementation file per usual, however, when I tried to run the code, I got a ton of compile errors. This seems to be an issue with my computer or IDE, but I have not seen it before. This should be relatively simple as it is for a class project.
  The code is as follows: </p>
  
  <p>colorPicker.h</p>
  
  <pre><code>#pragma once
  class colorPicker {
  private: 
      string colorArray[7];
  public: 
      colorPicker(); 
      void printAllColors(); 
      string randomColor(); 
  };
  </code></pre>
  
  <p>colorPicker.cpp</p>
  
  <pre><code>#include "colorPicker.h"
  #include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;ctime&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  using namespace std; 
  
  
  
  colorPicker::colorPicker() {
      colorArray[0] = "Red"; 
      colorArray[1] = "Green";
      colorArray[2] = "Purple";
      colorArray[3] = "Yellow";
      colorArray[4] = "Orange";
      colorArray[5] = "Indigo";
      colorArray[6] = "Pink";
  }
  
  void colorPicker::printAllColors() {
      for (int i = 0; i &lt; 7; i++) {
          cout &lt;&lt; colorArray[i] &lt;&lt; endl;
      }
  }
  
  string colorPicker::randomColor() {
      srand((unsigned)time(0)); 
      int j = 0; 
      j = rand() % 7; 
      return colorArray[j];
  }
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include "colorPicker.h"
  #include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;ctime&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  using namespace std;
  
  
  int main() {
      colorPicker p;
      p.printAllColors(); 
      cout &lt;&lt; "Random Color: " &lt;&lt; p.randomColor() &lt;&lt; endl; 
      system("pause");
      return 0; 
   }
  </code></pre>
  
  <p>There are 20 errors given by the compiler, however, they all seem to be stemming from two undeclared identifiers which are most definitely declared. I am at a loss for what I could possibly do to fix it, and this project is due Sunday. Thank you.</p>
  
  <p>Here are the errors
  <a href="https://i.stack.imgur.com/8QaMC.png" rel="nofollow noreferrer">Tons of Errors</a></p>