7

My Application was working perfectly on Snow Leopard with Xcode 4.2. Built with no errors and ran with the SQL database with no problem. I upgraded to Lion and Xcode 4.3.2 and when I Build, I get errors of "/usr/include/sqlite3.h file not found" on my #import "/usr/include/sqlite3.h" lines of code. Any one else have this problem or have any suggestions? I have tried deleting the libsqlite3.dylib from the Project Navigator, and then adding it back via the + sign in the Build Phases tab in the Link Binary With Libraries, but the error persists.

Bill
  • 81
  • 1
  • 3

2 Answers2

6

When updating from Snow Leopard to Lion and Xcode 4.2 to Xcode 4.5, your will got error: " '/usr/include/sqlite3.h' file not found".

Solution:

  • Add library: "libsqlite3.0.dylib" in the Target > Build Phases

  • Change #import "/usr/include/sqlite3.h" to #import "sqlite.h" in your code


Update to author's post: It is not #import "sqlite.h". It is: #import <sqlite3.h>


Krishna Raj Salim
  • 7,331
  • 5
  • 34
  • 66
DavidNg
  • 2,826
  • 6
  • 32
  • 45
1

I think what your problem is you need to include the SQLite 3.0 Framework into your project.

Refer to this question if you don't know how to add a framework: How to “add existing frameworks” in Xcode 4?

The framework you want is libsqlite3.0.dylib

Hope this helps!

Community
  • 1
  • 1
  • I tried including the libsqlite3.0.dylib in my framework, and changed my import statement to #import "/usr/include/sqlite3.0.h", but I still get the same error '/usr/include/sqlite3.0h' file not found. I tried removing the other sqlite3.dylib framework, but same error. I don't know if this has any bearing on it, but when I upgraded to xcode 4.3.2, I left the old xcode 4.2 on the system. – Bill May 02 '12 at 20:46
  • 10
    I FIGURED IT OUT. I kept playing around with the code, and I found that in either Lion or Xcode 4.3.2 (not sure which one is causing it), I only have to have the import statement say #import "sqlite3.h", not the whole path of "/usr/include/sqlite3.h". I fixed all my import statements and it works perfectly now. I think this question can be closed, unless there are any other comments. – Bill May 02 '12 at 22:00
  • Glad you figured everything out. – Caleb Jessie May 02 '12 at 22:05
  • 1
    @Bill 's comment should be added to the answer (ugh, and this answer should be selected, too.) – Toby Jan 15 '13 at 07:47