title: gcc compile multiple files
body: <p>I have these five source</p>
  
  <blockquote>
    <p>main.c<br> src_print1.c<br> src_print2.c<br> header_print1.h<br> header_print2.h<br></p>
  </blockquote>
  
  <p>the contents are simple and are as following for respective files:</p>
  
  <p><strong>main.c</strong></p>
  
  <pre><code>#include "header_print1.h"
  #include "header_print2.h"
  
  int main(int argc, char** argv) {
      print1();
      print2();
      return 0;
  }
  </code></pre>
  
  <p><strong>header_print1.h</strong></p>
  
  <pre><code>#ifndef PRINT_1
  #define PRINT_1
  
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  void print1();
  
  #endif
  </code></pre>
  
  <p><strong>header_print2.h</strong></p>
  
  <pre><code>#ifndef PRINT_2
  #define PRINT_2
  
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  void print2();
  
  #endif
  </code></pre>
  
  <p><strong>src_print1.c</strong></p>
  
  <pre><code>#include "header_print1.h"
  
  void print1() {
     printf("Hello 1\n");
  }
  </code></pre>
  
  <p><strong>src_print2.c</strong></p>
  
  <pre><code>#include "header_print2.h"
  
  void print2() {
     printf("Hello 2\n");
  }
  </code></pre>
  
  <p>Using <code>gcc</code> I have tried to compile using the following command line:</p>
  
  <pre><code>  gcc -I ./ -o test -c main.c src_print1.c src_print2.c
  </code></pre>
  
  <p>Everything is in the same folder.
  The error I get is:</p>
  
  <pre><code>gcc: cannot specify -o with -c or -S with multiple files
  </code></pre>
  
  <p>I looked up at gcc manual, but actually I don't understand what to do in this case, since usually I use IDE and not the command line.</p>