title: Error C1083: Cannot open include file: 'stdafx.h'
body: <p>When I compiled this program (from C++ Programming Language 4th edition):</p>
  
  <p><em>main.cpp</em></p>
  
  <pre><code>#include &lt;stdafx.h&gt;
  #include &lt;iostream&gt;
  #include &lt;cmath&gt;
  #include "vector.h"
  using namespace std;
  
  double sqrt_sum(vector&amp;);
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      vector v(6);
      sqrt_sum(v);
      return 0;
  }
  
  double sqrt_sum(vector&amp; v)
  {
      double sum = 0;
      for (int i = 0; i != v.size(); ++i)
          sum += sqrt(v[i]);
      return sum;
  }
  </code></pre>
  
  <p><em>vector.cpp</em></p>
  
  <pre><code>#include &lt;stdafx.h&gt;
  #include "vector.h" 
  
  vector::vector(int s)
  :elem{ new double[s] }, sz{ s }
  {
  }
  double&amp; vector::operator[](int i)
  {
      return elem[i];
  }
  int vector::size()
  {
      return sz;
  }
  </code></pre>
  
  <p><em>vector.h</em></p>
  
  <pre><code>#include &lt;stdafx.h&gt;
  class vector{
  public:
      vector(int s);
      double&amp; operator[](int i);
      int size();
  private:
      double* elem;
      int sz;
  };
  </code></pre>
  
  <p>It gave me these errors:</p>
  
  <p><img src="https://i.stack.imgur.com/ZD8sw.png" alt="errors"></p>
  
  <p>I run it on Microsoft Visual Studio 2013, on Windows 7. How to fix it?</p>