在Linux下使用LLVM Clang以及Blocks

2015-12-15 23:09:07 · 作者: · 浏览: 8

在Linux下使用LLVM Clang以及Blocks


可以从这个链接下载:http://llvm.org/releases/download.html


sudo apt-get install llvm
sudo apt-get install clang
sudo apt-get install libblocksruntime-dev


代码:


#include
#include


int main() {
? ? void (^hello)(void) = ^(void) {
? ? ? ? printf("Hello, block!\n");
? ? };
? ? hello();
? ? return 0;
}


编译与连接:
clang test.c -fblocks -lBlocksRuntime -o test