Question

I am trying to learn sqlite for the iphone and am using the tutorial at this link:

http://www.techotopia.com/index.php/An_Example_SQLite_based_iPhone_Application

I created a single view application and copied the code from the tutorial into the viewcontroller.h and .m files. After each section in the tutorial I compiled the code to make sure it is still working. I first get an error after I copy in the "Creating the Database and Table" section. I get the following errors.

Undefined symbols for architecture i386:
  "_sqlite3_open", referenced from:
      -[ViewController viewDidLoad] in ViewController.o
  "_sqlite3_exec", referenced from:
      -[ViewController viewDidLoad] in ViewController.o
  "_sqlite3_close", referenced from:
      -[ViewController viewDidLoad] in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have searched countless forums and tried numerous things. I have imported libsqlite3.dylib and libsqlite3.0.dylib. I am using xcode 4.2. It seems to be related to sqlite framework but I don't know how to fix it.

Any help you can provide will be greatly appreciated.

Thanks,

Ian

Was it helpful?

Solution

You probably need to add the libraries/frameworks for sqlite. Use this reference and add the entries for sqlite. Maybe you didn't add them to your current target?:

add frameworks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top