Amani
Amani

Reputation: 18123

SQLite Incomplete Type Error

I'm writing a C++ program that uses SQLite for database. For this line of code;

void testRun()
{
    // some code here

    sqlite3_stmt stmt;

    // some code here too
}

I get the following error;

error: aggregate 'sqlite3_stmt stmt' has incomplete type and cannot be defined
     sqlite3_stmt stmt;
                  ^

I'm using the amalgamated SQLite source code and have "sqlite3.h" included. What exactly causes this error and how can it be solved? I'm on Windows 7 64bit, using MinGW_64.

Upvotes: 3

Views: 1389

Answers (1)

John Zwinck
John Zwinck

Reputation: 249193

That's an opaque structure known only to the implementation. You can't create an instance of it, but you can create a pointer to one:

sqlite3_stmt* stmt;
sqlite3_prepare(db, "SELECT...", -1, &stmt, 0);

Upvotes: 3

Related Questions