I'm trying to figure out how to compile this snippet of code on macOS Sierra.
#import <Foundation/Foundation.h>
int main() {
NSLog(@"Hello World");
return 0;
}
On El Capitan, I could compile with this command.
clang -x objective-c -framework Foundation main.m
However, when I try that command on Sierra, I see these errors.
In file included from main.m:1:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:5:
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:44:12: error: unknown property attribute 'class'
@property (class, readonly) BOOL supportsSecureCoding;
This is the version of clang
that I'm using.
$ clang -v
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin16.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I have Xcode version 7.3.1 (7D1014) and Xcode version 8.0 beta 4 (8S188o) installed. The version of Sierra I have is 10.12 beta (16A254g).
Note: I want to compile this in the terminal with clang
, not inside of Xcode.