gpt4 book ai didi

iphone - 如何使用makefile编译iphone代码?

转载 作者:行者123 更新时间:2023-12-03 19:10:45 36 4
gpt4 key购买 nike

我想使用 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

最佳答案

将/opt/iphone/替换为/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/

现在您将看到系统上可用的编译器列表。顺便说一句:我没有插件目录,所以我猜它是您安装的某些特殊软件包的一部分。

[更新]: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。平台/开发者/SDKs/iPhoneOS4.2.sdk -gdwarf-2 -mthumb -miphoneos-version-min=4.2

我不太了解每个标志的详细信息,但值得尝试在 makefile 中的 CC 中设置它们。

关于iphone - 如何使用makefile编译iphone代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6452381/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com