我正在编写一个将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源代码,并且有#34; sqlite3.h"包括在内。究竟是什么导致了这个错误以及如何解决? 我在Windows 7 64bit上使用MinGW_64。
答案 0 :(得分:2)
这是一个只有实现才知道的不透明结构。您无法创建它的实例,但您可以创建指向它的指针:
sqlite3_stmt* stmt;
sqlite3_prepare(db, "SELECT...", -1, &stmt, 0);