SQLite3 - Cannot Open Database

I have the following code:

#include <iostream>
#include <string>
#include "sqlite3.h"
int main()
{

    sqlite3* db;
    int rc = sqlite3_open("testing.db",  &db);
    std::cout << rc << std::endl;
    std::cout << sqlite3_errmsg(db);
    std::cin >> rc;
}

      

When I run it, the program will print "21" and "library procedure called from sequence". What am I doing wrong? 21 is the code for SQLITE_MISUSE. See: http://www.sqlite.org/c3ref/c_abort.html

0


a source to share


1 answer


Call sqlite3_errmsg () to get the actual error message.

Edit: When I run your code it returns 0. Seems to work well here.



What system are you using the code on? How is your code compiled?

0


a source







All Articles