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 .
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 " "
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With