title: Header not refreshed - Visual C++ 2012
body: <p>Using Visual C++ 2012, without precompiled headers:</p>
  
  <p>When I change a header file that is included in multiple files, the change is not taken into account when building.
  If I rebuild all, the change is taken into account.</p>
  
  <p>Reproduction case:</p>
  
  <p><em>include.h</em></p>
  
  <pre><code>#ifndef INCLUDE_H_
  #define INCLUDE_H_
  
  class A {
  public:
     A(int i) : i_(i) { }
     int i_;
  };
  
  class B {
  public:
    B(int i = 1) : a_(i) { }
    A a_;
  };
  
  #endif INCLUDE_H_
  </code></pre>
  
  <p><em>dummy.cpp</em></p>
  
  <pre><code>#include "include.h"
  </code></pre>
  
  <p><em>main.cpp</em></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "include.h"
  
  int main(int, char**) {
    B b;
    std::cout &lt;&lt; b.a_.i_ &lt;&lt; std::endl;
    return 0;
  }
  </code></pre>
  
  <p>This outputs 1.</p>
  
  <p>Now I change <code>int i = 1</code> to <code>int i = 2</code> in <em>include.h</em>; I build and run, it outputs 1!
  I <em>rebuild</em> and run, it outputs 2.</p>
  
  <ul>
  <li><p>The <em>dummy.cpp</em> file is necessary to reproduce the error. In real-life, this file is using <em>include.h</em> but not classes A and B (but this doesn't seem to change anything; declaring a class C with members A and B in <em>dummy.cpp</em> will still reproduce the problem). When removing the file <em>dummy.cpp</em>, or renaming it to <em>zdummy.cpp</em> (presumably it will be compiled after <em>main.cpp</em>), then the problem disappears.</p></li>
  <li><p>I tried with include guards, with pragma once, with both of them, with none of them, the problem is reproduced in each case.</p></li>
  <li><p>I cannot reproduce this problem with Code::Blocks/GCC; I didn't try with older versions of Visual Studio.</p></li>
  </ul>
  
  <p>Am I missing something or is this really a bug in Visual Studio? If the latter, is there a known workaround? (Other than <em>re</em>-building at every step)</p>