title: Problems when compiling Objective C with Clang (Ubuntu)
body: <p>I'm learning Objective-C language. Since I don't have a Mac, I'm compiling and running my code within Ubuntu 11.04 platform.</p>
  
  <p>Until now, I was using gcc to compile. I've installed GNUStep and all was working. But then I started to try some Objective-C 2.0 features, like @property and @synthesize, that gcc does not allow.</p>
  
  <p>So I tried to compile the code with Clang, but it seems that it is not correctly linking my code with the GNUStep libraries, not even with a simple Hello world program.</p>
  
  <p>For example, if I compile the following code:</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  int main(void) {
    NSLog(@"Hello world!");
    return 0;
  }
  </code></pre>
  
  <p>The output of the compiler is:</p>
  
  <pre><code>/tmp/cc-dHZIp1.o: In function `main':
  test.m:(.text+0x1f): undefined reference to `NSLog'
  /tmp/cc-dHZIp1.o: In function `.objc_load_function':
  test.m:(.text+0x3c): undefined reference to `__objc_exec_class'
  collect2: ld returned 1 exit status
  clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>The command I'm using to compile is</p>
  
  <pre><code>clang -I /usr/include/GNUstep/ test.m -o test
  </code></pre>
  
  <p>with the -I directive to include the GNUStep libraries (otherwise, Clang is not able to find Foundation.h).</p>
  
  <p>I've googled my problem, and visited both GNUStep and Clang web pages, but I haven't found a solution to it. So any help will be appreciated.</p>
  
  <p>Thanks!</p>