PDA

View Full Version : How to add the sqlite3 framework to project




tutiplain
Apr 21, 2011, 08:23 PM
Hi all,

Here's a simple question, though I can't seem to figure it out on my own. I am trying to use sqlite on my app. I have #imported the sqlite3.h header file. But when I compile, I get a few warnings and the program does not compile:


Ld /Users/ocampos/Library/Developer/Xcode/DerivedData/SueldoCalc-erlcpmxwibxgvoewahrcnyaigkot/Build/Products/Debug-iphonesimulator/SueldoCalc.app/SueldoCalc normal i386
cd /Users/ocampos/Documents/SueldoCalc
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/ocampos/Library/Developer/Xcode/DerivedData/SueldoCalc-erlcpmxwibxgvoewahrcnyaigkot/Build/Products/Debug-iphonesimulator "-L/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib" -F/Users/ocampos/Library/Developer/Xcode/DerivedData/SueldoCalc-erlcpmxwibxgvoewahrcnyaigkot/Build/Products/Debug-iphonesimulator -filelist /Users/ocampos/Library/Developer/Xcode/DerivedData/SueldoCalc-erlcpmxwibxgvoewahrcnyaigkot/Build/Intermediates/SueldoCalc.build/Debug-iphonesimulator/SueldoCalc.build/Objects-normal/i386/SueldoCalc.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -lsqlite3.0 -o /Users/ocampos/Library/Developer/Xcode/DerivedData/SueldoCalc-erlcpmxwibxgvoewahrcnyaigkot/Build/Products/Debug-iphonesimulator/SueldoCalc.app/SueldoCalc

ld: warning: ignoring file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/libsqlite3.0.dylib, missing required architecture i386 in file
ld: warning: ignoring file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/libSystem.dylib, missing required architecture i386 in file
ld: in /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/libobjc.A.dylib, missing required architecture i386 in file for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1



I read in a tutorial that I need to add a reference to a file called libsqlite3.0.dylib, via de "Add Existing Frameworks" option, but the tutorial is old and I can't this option in Xcode 4. Can someone help me correct this? Any info will be greatly appreciated, as always.



idelovski
Apr 22, 2011, 09:36 AM
Info button on target and ....

http://www.asim-siddiqui.com/wp-content/plugins/rss-poster/cache/bcb4b_Screen-shot-2010-04-22-at-8.11.23-AM.png

dejo
Apr 22, 2011, 10:22 AM
Info button on target and ....

Except the OP is looking for direction on how to add frameworks in Xcode 4 not 3. :(

EDIT:

Xcode 4 Tips: Adding frameworks to your project (http://www.thinketg.com/Company/Blogs/11-03-20/Xcode_4_Tips_Adding_frameworks_to_your_project.aspx)

idelovski
Apr 22, 2011, 01:48 PM
Oh, my bad!

I was sure the old way was when we had to manually navigate to the propper SDK and its folder on disk.

tutiplain
Apr 23, 2011, 10:05 PM
HI,

A Google search showed me how to do it. You click on project name in the Project Explorer, then click on Build Phases, then the + button.

dejo
Apr 24, 2011, 12:40 AM
A Google search showed me how to do it.
Are you saying you posted here first, ignored the responses and just found a solution through Google anyways? Not nice.

You click on project name in the Project Explorer, then click on Build Phases, then the + button.
Which + button? There are three on the screen when you get to the point of adding the framework. If you're going to explain the solution to your issue, you should please be so kind to be specific enough that others readers can follow it as well.

tutiplain
Apr 24, 2011, 11:14 AM
Are you saying you posted here first, ignored the responses and just found a solution through Google anyways? Not nice.


Please don't take it that way, but if you look at the responses I got, one was apparently for XCode 3, which was not what I was looking for, and the other reply was not very helpful, although I did not see you had posted a link below yours until now. This does not mean that I am not grateful for the responses. It was in fact the first response which gave me idea on how to look for it in Google.

Still, I see your point, dejo. From now on, I will try to be more thorough when in doubt, lest I not ask something and then find a solution elsewhere. I'm sorry, and I apologize, to you, and the other repliers.


Which + button? There are three on the screen when you get to the point of adding the framework. If you're going to explain the solution to your issue, you should please be so kind to be specific enough that others readers can follow it as well.


I am not on my Mac right now, but I'll post a screenshot later showing where the option is.

tutiplain
Apr 24, 2011, 10:19 PM
Hi again, everyone.

As promised here's a screenshot of where the sqlite framework can be added to your project. As you can see, you first click on your project name on the Project Explorer (left side of the attached picture). This causes the middle pane switch to a tabbed interface with the labels, Summary, Info, Build Settings, Build Phases and Build Rules. You click on Build Phases and you are presented with a screen similar to the attached screenshot. Next click on the gray arrow besides "Link Binary with Libraries" to expand it. Listed, you should see the default frameworks, namely UIKit, Foundation and CoreGraphics. Next you click on the + sign below CoreGraphics (might be different on your system or project, I believe). This will bring down a list of frameworks and libraries you can add. On the top there is a spotlight icon, and a text field, type "libsqlite.0.dylib" there, and it should pop up on the list. Select it and press "Add". Now sqlite should appear on your list of frameworks, as well as the Project Explorer on the left. You should now be able to use the sqlite3 functions in your code.

One thing no one commented on was the errors and warnings I was getting. I still don't know what they were, but they started appearing after I attempted to add libsqlite as a resource (before figuring out the correct way to do it). I had to reinstall Xcode to make them go away. Anyway, I hope this info might of help to someone else :)

abbottarts
Nov 5, 2011, 04:57 PM
tutiplain, your comment of Apr 24, 2011 08:19 PM was incredibly helpful. You have saved me many hours of work, thank you.

I was able to eliminate my errors by simply quitting and re-opening Xcode. This may save the next hapless sap some time. I'm in Xcode 4.1 with iOS 4.3 as my target.

jnoxx
Nov 6, 2011, 08:40 AM
You could also press Command+Shift+K, which does a clean, and try rebuilding, with command shift B, if that doesn't fix it, then theres probably something wrong.

millergjean
Jul 7, 2013, 06:39 AM
Hi again, everyone.

As promised here's a screenshot of where the sqlite framework can be added to your project.

The instructions are very good and helpful. The screenshot was missing. I clicked on the project name under "Targets" in the Project Explorer and it worked perfectly. Regards, Gloria

ArtOfWarfare
Jul 7, 2013, 10:45 AM
tutiplain, your comment of Apr 24, 2011 08:19

I'd advise against mentioning times, particularly without a timezone, on the internet... tutiplain made no comment at that time in my timezone. I suggest using the "quote" button or giving a link to the post you're referring to.