使用 libsqlite3 库编译 iPhone 程序

发布于 2024-09-05 01:21:53 字数 1073 浏览 1 评论 0原文

我开发了一个使用 sqlite3 作为数据库的 iPhone 应用程序。当时我的 OS X 版本是 leopard。因此,将 libsqlite3.0.dylib 添加到框架中并编译,它不会出现任何问题,并且如果出现任何问题,我也可以在设备上运行它。

本周我在 Mac 上安装了 Snow Leopard。删除旧的 Leopard 版本并安装新的 Snow Leopard 系统。

但我现在的问题是我无法编译该程序,因为它会给出 sqlite3 库的错误。我使用选择目标然后选择文件添加了 sqlite3.0.dylib。还尝试添加直接从 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib 选择它,

当我编译到设备时和

编译到设备时编译到模拟器时, 我收到两个不同的错误, ld: 警告:在 /opt/local/lib/libsqlite3.0.dylib 中,文件不符合所需架构*

编译到模拟器时, ld:警告:在 /opt/local/lib/libsqlite3.0.dylib 中,文件是为不受支持的文件格式构建的,该格式不是正在链接的体系结构(i386) ld:警告:在 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib/libSystem.dylib 中,文件中缺少所需的架构 i386 ld:在 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib/libobjc.A.dylib 中,文件中缺少所需的架构 i386 命令 /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 失败,退出代码 1

我还尝试添加 sqlite3.dylib (,我认为 sqlite3.0.dylib 链接到 sqlite3。 dylib。)但没有运气。

那里的任何人都可以给我任何帮助吗?我真的很努力让它发挥作用。如果您想了解更多详细信息,请告诉我。

谢谢你, 瓦鲁纳

I develop an iphone application which uses sqlite3 as a database. That time my OS X version was leopard. So add added libsqlite3.0.dylib to frameworks and compile without any problems it complied and with any problems I could run it on the device as well.

This week I installed Snow Leopard on my Mac. Removing old Leopard version and install a fresh Snow leopard system.

But my problem is now I cannot compile that program because it will give errors with sqlite3 library. I added sqlite3.0.dylib using selecting targets and then selecting file. Also tried adding selecting it from directly /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib

I get two different errors when I compiled to device and to simulator

when compiled to device,
ld: warning: in /opt/local/lib/libsqlite3.0.dylib, file is not of required architecture*

When compiled to simulator,
ld: warning: in /opt/local/lib/libsqlite3.0.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib/libSystem.dylib, missing required architecture i386 in file
ld: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib/libobjc.A.dylib, missing required architecture i386 in file
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

i also tried with adding sqlite3.dylib (, I think sqlite3.0.dylib is linked to sqlite3.dylib.) but no luck.

Could any one out there give me any help. I'm really trying to get this working. Please let me if you want more details.

Thank you,
Waruna

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

巨坚强 2024-09-12 01:21:53

对于最初的请求者来说可能有点晚了。但对我有用的是转到查找器并从项目文件夹中删除 libsqlite.dylib 文件,然后再次添加框架引用。

希望这有帮助

Might be a little late for the original requestor. But what works for me is to go to finder and delete the libsqlite.dylib file(s) from the folder of your project and add the framework reference in again.

hope this helps

绝影如岚 2024-09-12 01:21:53

您必须链接到 SDK 路径中的库。当您选择“添加框架...”时,您将看到默认路径中可用的框架列表。不要离开此列表,而是从列表中选择 sqlite 库。

位于 /opt/local/lib/ 中的库仅供您计算机上运行的应用程序使用。不适用于 iPhone 应用程序。

You must link to the library which is in the SDK path. When you select "Add Framework..." you will be presented with a list of frameworks available in the default path. Don't navigate away from this list, but select the sqlite library from the list.

The library located in /opt/local/lib/ is only for use by application running on your computer. Not for iPhone applications.

甜警司 2024-09-12 01:21:53

我不明白为什么要添加与操作系统捆绑在一起的库。为什么不直接将源添加到您的项目中呢?它将让您可以自由地根据自己的条件更新 SQLite 版本,而不依赖于您机器上的 SQLite。如果用户运行旧版本的操作系统会发生什么?你会强迫他们升级系统吗?

I do not understand why add the library bundled with your OS. Why not just add the sources to your project? it will give you freedom to update the version of SQLite on your own terms and do not depend on the SQLite on your box. what happens if a user is running an older version of the OS? will you force them to upgrade their system?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文