title: What does the "undefined reference to varName" in C mean?
body: <p>I have 2 files: <code>a.c</code> and <code>b.c</code></p>
  
  <p>In <code>a.c</code> I am sending a signal to a function located in <code>b.c</code></p>
  
  <pre><code>signal(SIGUSR1,doSomething);
  </code></pre>
  
  <p>On top of the a.c file, I have:</p>
  
  <pre><code>extern void doSomething (int    sig);
  </code></pre>
  
  <p>When I compile, however, I get an error:</p>
  
  <blockquote>
    <p>/tmp/ccCw9Yun.o: In function <code>main':<br>
    a.c:(.text+0xba): undefined reference to</code>doSomething'<br>
    collect2: ld returned 1 exit status</p>
  </blockquote>
  
  <p>The following headers are included:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;signal.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;sys/wait.h&gt;
  </code></pre>
  
  <p>How do I fix this?</p>