title: Visual C++ Precompiled Headers errors
body: <p><strong>Update:</strong></p>
  
  <p>What are the effects of including stdafx.h in my header files?</p>
  
  <hr>
  
  <p>I started on a C++ project in Linux/Eclipse CDT and imported it into Visual C++/Windows. </p>
  
  <p>In Visual C++, I started using precompiled headers to speed up compilation and defined stdafx.cpp and stdafx.h. </p>
  
  <p>Here's my stdafx.h</p>
  
  <pre><code>#pragma once
  
  #include &lt;string&gt;
  #include &lt;vector&gt;
  #include &lt;map&gt;
  ...
  </code></pre>
  
  <p>and my stdafx.cpp</p>
  
  <pre><code>#include "stdafx.h"
  </code></pre>
  
  <p>In every .h and .cpp file, I have the following:</p>
  
  <pre><code>#pragma once //if in a header file
  #include "stdafx.h"
  </code></pre>
  
  <p>For both release and debug, I have "Create Precompiled Header (/Yc)". It compiled fine in debug mode, but in release mode it keeps reporting</p>
  
  <pre><code>error LNK2005: ___@@_PchSym_@00@UfhvihUaszlaDUwlxfnvmghUnnlUhixUnnlPeDUnnlPeDUivovzhvUvmgrgbOlyq@ already defined in A.obj
  </code></pre>
  
  <p>If I switch both to "Use precompiled header", I get in both Debug and Release</p>
  
  <pre><code>fatal error C1854: cannot overwrite information formed during creation of the precompiled header in object file:
  </code></pre>
  
  <p>Does anyone know what's going on?</p>