Unknown type name sqlite3 error

objective-c, sqlite

Solution

There are two related errors:

Unknown type name 'sqlite3'

And:

Use of undeclared identifier 'sqlite3'

If you receive either of those for SQLite references, you can import `sqlite3.h` to resolve them:

#import <sqlite3.h>

If you neglect to link to the `libsqlite3.0.dylib` under your target's "Linked Frameworks and Libraries" settings, you may also receive errors like so:

Undefined symbols for architecture i386:
  "_sqlite3_open", referenced from:
      -[ViewController openDatabase] in ViewController.o
  "_sqlite3_close", referenced from:
      -[ViewController closeDatabase] in ViewController.o

If you receive errors like that, then you can go to your "Target" settings and add `libsqlite3.0.dylib` to the list of "Linked Frameworks and Libraries" (see Project Editor Help: Linking to a library or framework).

Problem

I am new to iPhone and working on Xcode to connect with SQLite, when I am declaring `sqlite3` it throws the "Unknown type name sqlite3" error. My code is as follows: ``` #import "DBManager.h" static DBManager *sharedInstance = nil; static sqlite3 *database = nil; static sqlite3_stmt *statement = nil; ```

Original source