CoreFoundation、CoreServices、またはCoreGraphics(Carbonなど)を含むものをコンパイルしようとすると、次のエラーメッセージが表示されます。Mac OSX Sierra CoreFoundation/CoreServices/CoreGraphicsが動作しない
gcc x.c -framework Carbon
In file included from /usr/include/Availability.h:180:0,
from /usr/local/Cellar/gcc/6.2.0/lib/gcc/6/gcc/x86_64-apple-darwin16.1.0/6.2.0/include-fixed/math.h:46,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:24,
from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:19,
from /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:20,
from x.c:1:
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDateFormatter.h:53:34: error: 'introduced' undeclared here (not in a function)
kCFISO8601DateFormatWithYear API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = (1UL << 0),
^
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:777:39: error: 'deprecated' undeclared here (not in a function)
const CFStringRef kCFURLLabelColorKey API_DEPRECATED("Use NSURLLabelColorKey", macosx(10.6, 10.12), ios(4.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0));
^
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:777:39: error: 'message' undeclared here (not in a function)
const CFStringRef kCFURLLabelColorKey API_DEPRECATED("Use NSURLLabelColorKey", macosx(10.6, 10.12), ios(4.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0));
^
In file included from /System/Library/Frameworks/Security.framework/Headers/Security.h:81:0,
from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43,
from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27,
from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23,
from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22,
from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39,
from /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:20,
from x.c:1:
/System/Library/Frameworks/Security.framework/Headers/Authorization.h:194:7: error: variably modified 'bytes' at file scope
char bytes[kAuthorizationExternalFormLength];
^~~~~
In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:18:0,
from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
from /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:24,
from x.c:1:
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFont.h:53:40: error: initializer element is not constant
static const CGFontIndex kCGGlyphMax = kCGFontIndexMax;
誰でも問題の原因が考えられますか? MacOS SierraまたはXcodeをバージョン8.1にアップデートした後にこれが開始されたかどうかはわかりません。編集:プログラムはXcodeでコンパイルされているようですが、自作のgcc 6.2では端末ではコンパイルできません。
よろしくお願いいたします。 –
私は#includeを自分のcファイルに入れようとしましたが、大量のエラーが発生します。私も-framework Foundationでコンパイルしようとしましたが、助けにならないようです。私は何か間違っているのですか? –
@ Robert.Sはい。あなたが現在間違っている主なことは、ObjCのみを使ってCをコンパイルしようとしていることです。 – hidefromkgb