SQLite on the iPhone, strange linking errors
I've been reading through this tutorial for using a SQLite database within an iPhone app. This is great and I've got everything working nicely, in the Simulator. As soon as I build to device I get the following linker errors:
ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/usr/lib/libgcc_s.1.dylib, missing required architecture arm in file ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/usr/lib/libSystem.dylib, missing required architecture arm in file ld: in /Developer/SDKs/MacOSX10.6.sdk/usr/lib/libobjc.A.dylib, missing required architecture arm in file collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
I've tr开发者_运维问答ied including different versions of the libsqlite3.0.dylib files as mentioned around this site and other message boards but it doesn't make anything any different (and yes, I have tried cleaning).
If anyone has had a similar issue, how do you get around this?
It looks like you are linking against "Current OS" as SDK. You should select an iPhone SDK in your build settings.
Edit: Alternative you have selected a library in a different SDK than your current.
The solution to this was very bizarre, and I'm not entirely sure what I've done by removing it... However, this is what I did...
Under the target build settings, I noticed in the "Search Paths" section that under "Library Search Paths" the following was set:
"$(inherited)"
"$(DEVELOPER_DIR)/SDKs/MacOSX10.6.sdk/usr/lib"
"$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib"
"$(SRCROOT)"
I checked this with applications that I had created before iPhoneOS 3.1.3 was released and it was blank. By removing the above, my application built and compiled straight away...
Very strange. Thanks goes to Claus Broch for getting me 50% of the way there!
精彩评论