我发现(如下)在编译使用块的代码时需要使用 -fblocks。
我需要链接什么库才能让链接器解析_NSConcreteStackBlock?(在 Ubuntu 9.10 AMD64 上。)
chris@chris-desktop:~$ clang ctest.c
ctest.c:3:25: error: blocks support disabled - compile with -fblocks or pick a
deployment target that supports them
void call_a_block(void (^blockptr)(int)) {
^
ctest.c:11:19: error: blocks support disabled - compile with -fblocks or pick a
deployment target that supports them
call_a_block( ^(int y) {
^
2 diagnostics generated.
chris@chris-desktop:~$ clang ctest.c -fblocks
/tmp/cc-4sPSeO.o: In function `main':
ctest.c:(.text+0x79): undefined reference to `_NSConcreteStackBlock'
collect2: ld returned 1 exit status
clang: error: linker command failed with exit code 1 (use -v to see invocation)