In the context of a coding contest, I must copy/paste all my C++ code in a single html input form, the code being compiled remotely. With the code getting bigger, I'd like to split the code into several files.
So, I have several C++ source files, one is main.cc and some others headers such as f.h.
I'd like these source files to be concatenated in a single source file allinone.cc with so that i can compile with clang++ allinone.cc. 
I guess this can be achieved using clang preprocessor.
A minimal example would be:
- main.cc - #include <iostream> using namespace std; #include "f.h" int main() { f(); }
- f.h - #pragma once #include <iostream> using namespacestd; void f() { cout << }
The closest I could get is with :
clang -E -nostdinc main.cc | grep -v "^#" > allinone.cc 
which produces:
#include <iostream>
         ^~~~~~~~~~
1 error generated.
using namespace std;
using namespacestd;
void f() {
  cout <<
}
int main() {
   f();
}
The -nostdinc option successfully avoids including code from standard includes. However, the original #include <iostream> disappears and the namespace specification is repeated. 
Is there a way to invoke clang preprocessor to achieve the concatenation described in a straight forward manner?
 
     
    