title: Can I get GCC to do partial preprocessing to only add my header files to C file?
body: <p>I'm kind of experimenting here. Out university has (quite poorly crafted) homework assignment automatic evaluation system. Currently their system allows only <code>main.c</code> file.</p>
  
  <p>I have few debug macros and other things that I consistently use through any simple C code I write. But manually copy pasting them into <code>main.c</code> gets annoying.</p>
  
  <p>I googled how to run <code>gcc</code> preprocesor over my <code>c</code> file.</p>
  
  <pre><code>gcc -E main.c -omain_no_header.c
  </code></pre>
  
  <p>This creates file that requires no headers at all. It's necessary to remove now redundant <code># xxx</code> stuf from that file:</p>
  
  <pre><code>grep -v '^#' main_no_header.c &gt; main_no_header_clean.c
  </code></pre>
  
  <p>Such file compiles perfectly with this command:</p>
  
  <pre><code>gcc -Wall -pedantic -std=c99 main_no_header_clean.c -o main
  </code></pre>
  
  <p>No warnings at all. But it contains some quite twisted stuff:</p>
  
  <pre><code> wint_t __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) _fgetwchar (void);
  </code></pre>
  
  <p>There is also some Windows stuff. This causes lot's of error if I upload this file as an assignment.</p>
  
  <p>So to the question: Can I make GCC create such preprocessed file that will <strong>NOT</strong> have any system libraries unrolled? Specifically, I only want to unroll/embed the files that are within my project (eg. <code>main.h</code>, <code>debug_macros.h</code> etc).</p>
  
  <p>Of course if this is not an option, I'll have to write a script to do it using regular expressions.</p>