title: undefined symbol for architecture x86_64 in compiling C program
body: <p>I have a simple program as
  <strong>demo_use.c</strong></p>
  
  <pre><code>#include "libhello.h"
  
  int main(void) {
   hello();
   return 0;
  }
  </code></pre>
  
  <p><strong>libhello.h</strong></p>
  
  <pre><code>void hello(void);
  </code></pre>
  
  <p><strong>libhello.c</strong></p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void hello(void) {
    printf("Hello, library world.\n");
  }
  </code></pre>
  
  <p>I have used the command in terminal as</p>
  
  <pre><code>gcc demo_use.c -o test
  </code></pre>
  
  <p><strong>error</strong> 
  Undefined symbols for architecture x86_64: "_hello",</p>
  
  <p>referenced from: _main in ccZdSQP3.o</p>
  
  <p>ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status</p>