Xcode: Build fails every time for a simple Hello Word program

瘦欲@ 提交于 2019-12-08 04:58:38

问题


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);
}

回答1:


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! ;)



来源:https://stackoverflow.com/questions/26071209/xcode-build-fails-every-time-for-a-simple-hello-word-program

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!