$ cat t1.c
#include <CoreFoundation/CoreFoundation.h>
$ gcc t1.c
In file included from /usr/include/dispatch/dispatch.h:51,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
from t1.c:1:
/opt/local/lib/gcc9/gcc/x86_64-apple-darwin14/9.2.0/include-fixed/dispatch/object.h:373:3: error: unknown type name 'dispatch_block_t'; did you mean 'dispatch_object_t'?
373 | dispatch_block_t notification_block);
| ^~~~~~~~~~~~~~~~
| dispatch_object_t
有什么帮助吗?
尝试使用clang,而不是gnu-gcc。当我使用/usr/local/bin/gcc作为编译器时,遇到了同样的问题。转到/usr/local/clang,解决我的问题。