title: Clang block in Linux?
body: <p>Clang has a very cool extension named <a href="http://en.wikipedia.org/wiki/Blocks_(C_language_extension)" rel="noreferrer">block</a> bringing true lambda function mechanism to C. Compared to block, gcc's nested functions are quite limited. However, trying to compile a trivial program <code>c.c</code>:</p>
  
  <pre>
  #include &lt;stdio.h&gt;
  
  int main() {
      void (^hello)(void) = ^(void) {
          printf("Hello, block!\n");
      };
      hello();
      return 0;
  }
  </pre>
  
  <p>with <code>clang -fblocks c.c</code>, I got</p>
  
  <pre>
  /usr/bin/ld.gold: /tmp/cc-NZ7tqa.o: in function __block_literal_global:c.c(.rodata+0x10): error: undefined reference to '_NSConcreteGlobalBlock'
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </pre>
  
  <p>seems I should use <code>clang -fblocks c.c -lBlocksRuntime</code>, but then I got</p>
  
  <pre>
  /usr/bin/ld.gold: error: cannot find -lBlocksRuntime
  (the rest is the same as above)
  </pre>
  
  <p>Any hints?</p>