views:

338

answers:

2

Hi,

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

A: 

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.

Claus Broch
Hey Claus I did that , but still it gave me same errors , that why tired navigating away from default path and tried other methods. Do you have any idea why. This perfectly worked in Leopard.
" ld: warning: in /opt/local/lib/libsqlite3.0.dylib, file is not of required architecture" shows that your are actually linking with the wrong library. Try deleting the library from your project and adding it again.
Claus Broch
yeah i did that , but no luck :(
Make sure you don't have any custom search paths defined which misdirect the linker to look in odd places for the library.
Claus Broch
That didnt worked either, I created new project and check then it worked fine. After that import all source code to new project, and now working fine
A: 

Are you using libsqlite3.0.dylib or libsqlite3.dylib ?

Helen