2

I'm trying to catch data from a sqlite3 database and list them in an UITableView. I have added the libsqlite3 framework but when I run it I get like 10 errors, one for each sqlite line. One of the messages I get is:

"_sqlite3_close", referenced from:
 -[AppDelegate initializeDatabase] in AppDelegate.o

Almost every message are like this but with different sql lines. initializeDatabase is a method where the database is opened.

What could be wrong?

1 Answer 1

1

It looks as though you've got the libsqlite headers in your header search path, but the sqlite library itself is not linked to your target.

  • Click on the target for your application.
  • Open the Build Phases tab
  • Choose 'Link Binary with Libraries', and add sqlite

enter image description here

Rather, then using the raw-C interface to sqlite, which is quite verbose you may wish to use an Objective-C wrapper. One popular wrapper is called FMDB, and this library can be quickly installed using the popular CocoaPods library manager tool.

CocoaPods will save you time, by automatically linking in your libraries, as well as any transitive dependencies (libraries that the library uses). While this is very convenient its still important to gradually learn what happens behind the scenes, so do try to set up some libraries manually, as you've done, as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.