문제

I am creating a simple command line app that uses Core Foundation, so from what I understand, that means I can use Objective-C.

The problem is, as soon as I include my Objective-C header, I get 19 build errors. The only line of code I added was the "include objective-c-header.h", the rest of my application is just the boiler plate code that XCode generates.

If I comment out that line, everything builds fine.

The errors are all parse errors and are in: - NSObjCRuntime.h - NSZone.h - NSObject.h

Is the compiler trying to build these as regular C headers? Is it possible to define an Objective C class in a command-line application?

도움이 되었습니까?

해결책

You want Foundation, not Core Foundation. Core Foundation is a C-only framework and does not contain the Objective-C runtime libraries.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top