title: using header files and StdAfx.h
body: <p>Ihave simple test console application. I'm trying to use function nike2 from defined in simple.h file and realization is in simple.cpp. Both simple.h and simple.cpp files are in different directory than main project. </p>
  
  <p>I have added simple.h to "Header files" and simple.cpp to "Source files" in project explorer (I'm not sure it is needed)</p>
  
  <p>Console app:</p>
  
  <pre><code>#include "stdafx.h"
  #include "..\..\simple.h"
  
  int _tmain(int argc, _TCHAR* argv[])
  {
  nike2(5);
  return 0;
  }
  </code></pre>
  
  <p>Simple.h</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  
  #ifndef MEMORY
  #define MEMORY
  
  int var;
  int  nike2(int f);
  
  #endif /*MEMORY*/
  </code></pre>
  
  <p>Simple.cpp</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include "simple.h"
  
  
  int  nike2(int f)
  {
   return 0;
  }
  </code></pre>
  
  <p>While compile I got error:</p>
  
  <pre><code>Error   4   error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?   c:\c\simple.cpp 11  1   usingHeader
  </code></pre>
  
  <p>Why? What is magic "StdAfx.h" used for?</p>
  
  <p>UPD</p>
  
  <p>simple.cpp now looks this way, but still have the same error</p>
  
  <pre><code>#include "C:\c\usingHeader\usingHeader\stdafx.h"
  #include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include "simple.h"
  
  
  int  nike2(int f)
  {
  return 0;
  }
  </code></pre>