Xcode:对于简单的 Hello Word 程序,每次构建都会失败 [英] Xcode: Build fails every time for a simple Hello Word program

查看:26
本文介绍了Xcode:对于简单的 Hello Word 程序,每次构建都会失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很奇怪:我正在尝试运行一个简单的 Hello World 程序,但 Xcode 说构建失败"

我在日志导航器中看到它说 2 个警告和 1 个错误:

<块引用>

Command/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang 失败,退出代码为 1

代码:

#import int main (int argc, const char *argv[]){NSLog (@"你好,Objective-C!");返回 (0);}

解决方案

显然,我忽略了以下警告:

<块引用>

体系结构x86_64"和变体normal"的 OS X 部署目标11.0"大于 OS X 10.8 SDK 的最大值10.8".

解决方案: 打开构建设置(从项目导航器)并检查 OS X 部署目标的值.根据我的配置,它应该是 10.8,也如我的警告中所示.

感谢大家的帮助,吸取了教训:永远不要忽视警告!;)

Very strange: I am trying to run a simple Hello World program, but Xcode say "Build Failed"

I saw in the Log Navigator it say 2 warning and 1 error:

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

Code:

#import <Foundation/Foundation.h>
int main (int argc, const char *argv[])
{
    NSLog (@"Hello, Objective-C!");
    return  (0);
}

解决方案

Apparently, I ignored the warnings which said:

OS X deployment target '11.0' for architecture 'x86_64' and variant 'normal' is greater than the maximum value '10.8' for the OS X 10.8 SDK.

Solution: Open Build Settings (from Project Navigator) and check the value of OS X Deployment target. It should be 10.8 based on my configuration and also as indicated in my warning.

Thanks for help everyone, Lesson Learned: Never Ignore the warnings! ;)

这篇关于Xcode:对于简单的 Hello Word 程序,每次构建都会失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆