title: How do I run the preprocessor on local headers only?
body: <p>I want the preprocessor to read in the includes of local headers, but ignore the includes of system headers.  To put it another way, how do I get the preprocessor to skip over preprocessing directives of the form:</p>
  
  <pre><code>#include &lt;h-char-sequence&gt; new-line
  </code></pre>
  
  <p>but still process directives of the form:</p>
  
  <pre><code>#include "q-char-sequence" new-line
  </code></pre>
  
  <hr>
  
  <p>As a code example, observe the following file:</p>
  
  <pre><code>#include &lt;iostream&gt;     //system
  #include "class_a.hpp"  //local
  #include &lt;string&gt;       //system
  #include "class_b.hpp"  //local
  
  int main() {}
  </code></pre>
  
  <p>how can I get the output of the preprocessor to be:</p>
  
  <pre><code>#include &lt;iostream&gt;
  class A{};
  #include &lt;string&gt;
  class B{};
  
  int main() {}
  </code></pre>
  
  <hr>
  
  <p>Local include files may include other local include files, and the preprocessor would recursively bring them all in; much like it normally does.  It would still print all of the system file headers, but it would not bring in their contents.</p>
  
  <hr>
  
  <p>on gcc, my call looks like this so far: <code>g++ -E -P main.cpp</code>, where <code>-E</code> stops after preprocessing, and <code>-P</code> excludes the generation of line markers.<br>
  I can't seem to find a flag that excludes the processing of system headers.</p>