title: Expand #includes to a text file for C++
body: <p>Is it possible to expand out <code>#include</code> lines of a c++ file, probably using the <strong>C</strong> preprocessor, such that I can read an extended file without <code>#includes</code>, but instead with the files that are <code>#include</code>d?</p>
  
  <p>To be concrete, if I have </p>
  
  <p>fileA.cpp:</p>
  
  <pre><code>#include "fileB.H"
  
  int main()
  {
  //do whatever
  return(0);
  }
  </code></pre>
  
  <p>fileB.H:</p>
  
  <pre><code>#include "fileC.H"
  //Some lines of code
  </code></pre>
  
  <p>fileC.H</p>
  
  <pre><code>//Some other lines of code
  </code></pre>
  
  <p>And output:</p>
  
  <pre><code>//Some other lines of code
  //Some lines of code
  
  int main()
  {
  //do whatever
  return(0);
  }
  </code></pre>
  
  <p>Essentially, copy-pasting the files that are included into one large text/C++ code file, without compiling?</p>
  
  <p>If I run the cpp with relevant <code>-I&lt;Directory containing files to include&gt;</code> then I get a long text file, but rather than just code, it gives what would be passed to the compiler (duh!)</p>