【问题标题】:Does OS matter when compiling for iPhone?为 iPhone 编译时操作系统是否重要?
【发布时间】:2009-09-08 08:22:03
【问题描述】:

我是 iPhone 开发的新手,目前正在尝试将一些静态库添加到我的项目中,但出现“未找到符号”错误。

我已经用谷歌搜索了这个问题并尝试了不同的解决方案,但没有任何运气。这些库是在 PC 上而不是在 Mac 上编译的,所以我的问题是:

我需要在 Mac 上编译代码吗? 我需要什么工具才能编译它们?

我已将标题包含在项目中。我试图链接的代码是用 c 编写的,并且是为 ARM GCC 4.2 编译的。

我收到以下错误代码:

ld 警告:在 /Users//Playground/Collage/libbaseapi.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/capseng.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/excodecs.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmautorama.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmclearshot.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmexif.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmextencoder.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmfacewarp.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmfxplugin.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmimageenhance.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmimagefusion.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmjpegsqueeze.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmjpegtools.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmphotoart.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmredaway.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmsemc.a 中,文件不是必需的架构 ld 警告:在 /Users//Playground/Collage/fmspeedview.a 中,文件不是必需的架构

未定义的符号: “_caps_destroyBuffer”,引用自: -[CollageMainView drawRect:] 在 CollageMainView.o ld:未找到符号 collect2: ld 返回 1 个退出状态 “_caps_destroyBuffer”,引用自: -[CollageMainView drawRect:] 在 CollageMainView.o ld:未找到符号 collect2: ld 返回 1 个退出状态 构建失败(1 个错误)

BR, 安德烈亚斯

【问题讨论】:

  • 如果您发布完整的错误消息可能会有所帮助。

标签: iphone-sdk-3.0 static-libraries


【解决方案1】:

您不能将自定义(编译)库添加到 iPhone 应用程序。您应该始终在项目中包含源代码。

【讨论】:

  • 嗯,这在技术上是可行的,但根据 iPhone 开发者文档,这是不允许的。
  • 我们的意图不是在 App Store 上发布我们的应用程序,我们只是在做一个 prof of concept 应用程序。如果按照您的说法在技术上是可行的,您知道这些库是应该在 Mac 上编译还是应该与在 PC 上编译的库一起使用?非常感谢您的帮助。
【解决方案2】:

您需要将库的头文件添加到项目中, 或者如果它是缺少的框架,请将其添加到 Xcode 中的“框架”文件夹中。

【讨论】:

  • 这些库是 *.a 类型的,是用 c 代码编写的,我通过将标题拖放到项目中来将它们包含到项目中。
猜你喜欢
  • 2010-09-18
  • 1970-01-01
  • 2014-08-14
  • 2023-03-18
  • 2020-08-21
  • 2021-06-09
  • 1970-01-01
  • 2014-11-11
  • 2019-07-30
相关资源
最近更新 更多