title: C++ Stage Between Linking and Compiling a File
body: <p>EDIT: FOR FUTURE VIEWERS -- See Ken White's comment for an answer. (As it turns out, the premise of my question was slightly flawed, however, this exchange may help future students as it did me.)</p>
  
  <p>I have a program consisting of several cpp and several header files. I would like to understand what happens after the linker links all of these files, and preferably <strong>find a way to view the project as if it were already linked together</strong>.</p>
  
  <p>Browsing through the project directory right now, I see <em>.o</em> files, which I know are object files. I see the individual <em>.cpp</em> and <em>.h</em> files as well as a <em>.exe</em>. But, to my dismay, I see no file which shows the entirety of the program. <strong>Is there one massive .cpp file that I can view?</strong> My understanding is that this file amalgamation is what happens after the linking occurs anyway, right before the compiling step happens. </p>
  
  <p><strong>Here is an analogous series of files (and the files they include), which, together make a whole program:</strong></p>
  
  <p>file: main.cpp</p>
  
  <pre><code>    #include "classA.h"
      #include "classB.h"
  </code></pre>
  
  <p>file: classA.cpp</p>
  
  <pre><code>    #include "classA.h"
  </code></pre>
  
  <p>file: classB.cpp</p>
  
  <pre><code>    #include "classB.h"
  </code></pre>
  
  <p>file: classA.h</p>
  
  <p>file: classB.h</p>
  
  <p><strong>But what I want to view is how the code would look if at had been linked already, something like:</strong></p>
  
  <p>file: mysterious.cpp (which would contain the contents of:)</p>
  
  <pre><code>    classA.h
      classA.cpp
      classB.h
      classB.cpp
      main.cpp
  </code></pre>
  
  <p><strong>But altogether, with line numbers.</strong></p>
  
  <p><em>For context, I came up with this question while using valgrind to detect memory leaks and noting that errors seemed to be occurring at line numbers in my program which seemed too large to exist in any of the individual files.</em></p>
  
  <p>--an inquisitive student</p>