tags:

views:

412

answers:

1

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 outputs "21" and "library routine called out of sequence". What am I doing wrong? 21 is the code for SQLITE_MISUSE. See: http://www.sqlite.org/c3ref/c_abort.html

A: 

Call sqlite3_errmsg() to get the actual error message.

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

Which system are you running the code on? How was your code compiled?

jalf