pmor
pmor

Reputation: 6276

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?

Upvotes: 0

Views: 896

Answers (1)

Garcon233
Garcon233

Reputation: 11

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.

Upvotes: 1

Related Questions