构建Xcode 8命令行工具模板需要哪些步骤?

时间:2016-09-16 18:10:27

标签: objective-c xcode macos xcode8

MacOS命令行工具的模板项目不能在XCode 8中为我构建。这是整个代码:

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        // insert code here...
        NSLog(@"Hello, World!");
    }
    return 0;
}

导入行发生故障。错误输出的开头如下所示。

我有一台运行El Capitan的新机器。我在一周前从GM下载(不是应用程序商店)安装了Xcode 8。

我需要做些什么来构建它?

错误输出:

In file included from /Users/ahcox/dev/macos/CommandLine001/CommandLine001/main.m:9:
In file included from /Users/ahcox/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:48:
In file included from /Users/ahcox/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSKeyedArchiver.h:9:
/Users/ahcox/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h:20:9: error: unknown type name 'CGPoint'; did you mean 'Point'?
typedef CGPoint NSPoint;
        ^
In file included from /Users/ahcox/dev/macos/CommandLine001/CommandLine001/main.m:9:
In file included from /Users/ahcox/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from /Users/ahcox/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
In file included from /Users/ahcox/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:77:
/Users/ahcox/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/MacTypes.h:542:41: note: 'Point' declared here
typedef struct Point                    Point;
                                        ^
...

1 个答案:

答案 0 :(得分:0)

/Applications/

下安装Xcode

查看这些路径,Xcode直接从下载目录运行,在该目录中,它从GM种子xip文件中解压缩(即它在"/Users/ahcox/Downloads/Xcode.app/"中)。手动将其复制到/Applications/或运行App Store应用程序,让它在需要的地方安装Xcode。为了解决这个问题,我做了后者。 有关installation of apps on MacOS的更多信息。