title: C makefile errors
body: <p>I have a custom header file example.h which has prototypes for a few functions. There is a .C file example.c that I implemented which "includes" (#include "example.h") and has the implementations of the functions that has prototype in example.h.  Now, I have another function test.c that calls the functions that are prototyped in example.h and defined in example.c. </p>
  
  <p>My make file is as follows </p>
  
  <pre><code>test: test.o
      gcc -o test -g test.o
  
  test.o: test.c example.c example.h  
      gcc -g -c -Wall test.c
      gcc -g -c -Wall example.c
  
  clean:
      rm -f *.o test
  </code></pre>
  
  <p>I get following message for the functions that are defined in example.c</p>
  
  <p>Undefined                       first referenced
   symbol                             in file</p>
  
  <p>function1                        test.o</p>
  
  <p>function2                        test.o</p>
  
  <p>function3                        test.o</p>
  
  <p>function4                        test.o</p>
  
  <p>ld: fatal: Symbol referencing errors. No output written to test</p>
  
  <p>collect2: ld returned 1 exit status</p>
  
  <p><em>*</em> Error code 1</p>
  
  <p>make: Fatal error: Command failed for target `test'</p>
  
  <p>Any help is most appreciated.</p>