McLan
McLan

Reputation: 2688

SQLite: error: C1083: cannot open include file: 'sqlite3.h'

I am following this tutorial on how to implement SQLite in c\c++. However, when compiling the following code:

#include <stdio.h> 
#include <sqlite3.h>

int main(int args, char* argv[]){
    sqlite *db;
    char *zErrMsg = 0;
    int rc;   
    rc = sqlite3_open("database_1.db", &db);
    if(rc){
      fprintf(stderr, "Can't open databse: %s\n", sqlite3_errmsg(db));
      exit(0);
    }else{ 
      fprintf(stderr, "Opened database successfully\n");
    }
    sqlite3_close(db);
}

I receive the following error: C1083: cannot open include file:'sqlite3.h': no such file or directory.

what is the problem and how to solve it.

Note: sqlite was downloaded and installed following this guidance .

Upvotes: 3

Views: 17791

Answers (3)

madx
madx

Reputation: 7203

It looks like you need to install libsqlite3-dev:

sudo apt-get install libsqlite3-dev

Upvotes: 2

Marius Bancila
Marius Bancila

Reputation: 16338

Make sure you have the folder with the library headers added to the Additional include directories. See http://msdn.microsoft.com/en-us/library/73f9s62w.aspx.

Upvotes: 2

Mateusz Jacobsen
Mateusz Jacobsen

Reputation: 451

Make sure that your compiler can actually see sqlite3 includes.

In gcc you'd do something like:

g++ main.cpp -I<path_to_sqlite3>

Without "-I" parameter, your #include cannot be seen by the compiler.

If sqlite3.h file is in the same directory as your "main.cpp" file - change your include to:

#include "sqlite3.h"

If you are unsure about the difference, please read: Difference between #include < > and " "

Upvotes: 4

Related Questions