我想使用make命令编译iPhone应用程序。但它总是显示错误
make: /opt/iphone/bin/arm-apple-darwin-gcc: No such file or directory
make: *** [src/main.o] Error 1
以下是makefile内容。
CC=/opt/iphone/bin/arm-apple-darwin-gcc \
-isysroot /opt/iphone/addons/1.0.2/system \
-isystem /opt/iphone/include \
-isystem /opt/iphone/include/gcc/darwin/3.3 \
-F/opt/iphone/addons/1.0.2/system/System/Library/Frameworks
如何编译我的应用程序。我不熟悉unix命令。所以请一步一步指导我。
更新
现在在更改路径后收到错误。
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10,
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:9,
from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:9,
from src/main.m:23:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h: At top level:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:15: error: syntax error before ‘BOOL’
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOs4.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:16: fatal error: method definition not in @implementation context
compilation terminated.
make: *** [src/main.o] Error 1
答案 0 :(得分:6)
替换/ opt / iphone / by /Developer/Platforms/iPhoneOS.platform/Developer/usr/或您的gcc所在的位置。如果我查看我的bin子目录,就没有arm-apple-darwin-gcc,而是arm-apple-darwin10-llvm-gcc-4.2。
打开终端并输入
cd /Developer/Platforms/iPhoneOS.platform/Developer/usr
ls bin/
现在您将看到系统上可用的编译器列表。 BTW:我没有addons目录,所以我猜它是你安装的一些特殊软件包的一部分。
[<强>更新强>]: 以下标志在XCode中设置:
-x objective-c -arch armv7 -fmessage-length = 0 -pipe -std = c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -isysroot / Developer / Platforms / iPhoneOS。 platform / Developer / SDKs / iPhoneOS4.2.sdk -gdwarf-2 -mthumb -miphoneos-version-min = 4.2
我对每个标志的细节知之甚少,但是值得尝试在你的makefile中将它们设置在CC中。