Merge C++ files into a single source file
<p>I have a c++ project with multiple source files and multiple header files.  Sometimes, I wan't to send someone my project (usually for a programming contest) and it would be nice if there was an automated way of collapsing all the files into single .cpp file.</p>

<p>So for example if I had a.cpp, a.h, b.cpp, b.h etc., I want to get a main.cpp which will compile and run successfully.  If no tool is available, I imagine all you need to do is to merge the header files and append the source files to each other?  However are there gotchas with externs, include dependencies and forward declarations?</p>
