gpt4 book ai didi

c++ - SQLite 不完整类型错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:45:09 25 4
gpt4 key购买 nike

我正在编写一个使用 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);

关于c++ - SQLite 不完整类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22880981/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com