title: Using precompiled headers with a static library project
body: <p>I am in need of some advice on how to setup my project.  I'm building a static library and want to know if the way I'm using precompiled headers is correct before I go too far.</p>
  
  <p>So far, my stdafx file is just including  (for types like DWORD, etc.) and  (for std::string).</p>
  
  <p>I built a simple cpp/header combo called TestFuncs.cpp/h</p>
  
  <p>TestFuncs.cpp:</p>
  
  <pre><code>#include "stdafx.h"
  using namespace std;
  void MyFunc(DWORD a, string b) {
      // irrelevant
  }
  </code></pre>
  
  <p>TestFuncs.h</p>
  
  <pre><code>#pragma once
  void MyFunc(DWORD a, std::string b);
  </code></pre>
  
  <p>This code here compiles properly.  The issue that I have is when I want to use this static library in another project, I would normally do #include "path_to_my_static_lib_project/TestFuncs.h"</p>
  
  <p>However, the issue with this, is based upon TestFuncs.h, both DWORD and string would be unknown at the time, as they are types defined from the stdafx.h file.</p>
  
  <p>One solution that I came up with (that I don't know it's correct to be doing so) is just including stdafx.h at the top of TestFuncs.h after the #pragma once.  Now the project works file using precompiled headers or not.</p>
  
  <p>Is this how it should be done, or is there a proper way of doing this?</p>
  
  <p>Thank you.</p>