SQLite 不完整类型错误

SQLite Incomplete Type Error

本文关键字:类型 错误 SQLite      更新时间:2023-10-16

我正在编写一个使用 SQLite 作为数据库的C++程序。对于这行代码;

void testRun()
{
    // some code here
    sqlite3_stmt stmt;
    // some code here too
}

我收到以下错误;

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

我正在使用合并的SQLite源代码,并包含"sqlite3.h"。究竟是什么导致了此错误,如何解决?我在Windows 7 64位上,使用MinGW_64。

这是一个只有实现才知道的不透明结构。 您无法创建它的实例,但可以创建指向一个实例的指针:

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