2014-09-27 33 views
1

很奇怪:我想運行一個簡單的Hello World程序,但Xcode中說:「構建失敗」的Xcode:構建失敗,每一次爲一個簡單的Hello Word程序

我在日誌導航看到它說2警告和1個錯誤:

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

代碼:

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

http://backup.noiseandheat.com/blog/2012/01/clang-failed-with-exit-code-1/? – odedsh 2014-09-27 04:20:14

+0

嘗試創建一個新項目並運行它... – 2014-09-27 04:20:44

回答

1

顯然,我忽略了它說的警告:

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. 

解決方案:打開構建設置(從Project Navigator)並檢查OS X部署目標的值。它應該是10.8根據我的配置,也如我的警告中所示。

感謝大家的幫助,經驗教訓:永不忽略警告! ;)