问题
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