'OS X: #include <CoreFoundation/CoreFoundation.h> leads to error: unknown type name 'dispatch_block_t'
$ 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
Any help?
Solution 1:[1]
try using clang, not gnu gcc. when I was using /usr/local/bin/gcc as a compiler, met the same issue. Turning to /usr/local/clang, fix my problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Garcon233 |
