开发者

Compiling iPhone program wtih libsqlite3 library

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开发者_如何学JAVA 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


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


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.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜