title: C - Undefined symbols for architecture x86_64 when compiling on Mac OSX Lion
body: <p>I'm getting some problems on compiling a very very simple name.c file on Mac OSX Lion.</p>
  
  <p>Now, I started following Harvard CS50 course on cs50.net. I'm not totally new to programming but I was curious on how this course has been taught. </p>
  
  <p>This is the source of name.c:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;cs50.h&gt;
  
  int
  main(void)
  {
      printf("State your name:\n");
      string name = GetString();
      printf("O hai, %s!\n", name);
      return 0;
  }
  </code></pre>
  
  <p>As you can see, it requires this library: <a href="https://manual.cs50.net/CS50_Library" rel="nofollow noreferrer">https://manual.cs50.net/CS50_Library</a>.</p>
  
  <p>Now, when I compile it, this happens:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_GetString", referenced from:
        _main in name-vAxcar.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make: *** [name] Error 1
  </code></pre>
  
  <p>If I use the same GetString() cs50.c function inside my source file, it works perfectly:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;float.h&gt;
  #include &lt;limits.h&gt;
  #include &lt;stdbool.h&gt;
  #include &lt;stdlib.h&gt;
  
  typedef char *string;
  
  string GetString(void);
  
  int
  main(void)
  {
      printf("State your name:\n");
      string name = GetString();
      printf("O hai, %s!\n", name);
   }
  
  string
  GetString(void)
  {
      // CODE
  }
  </code></pre>
  
  <p>Why does this happen?
  I installed the library as it says on the link above; I checked and both cs50.h and libcs50.a are respectively in /usr/local/include and /usr/local/lib.</p>
  
  <p>Thank you in advance for your help.</p>