我是 Eclipse 中 c/c++ 的新手,尝试使用 sqlite 合并为 MATLAB 编写一些 sqlite 例程。
我遇到了这个问题,eclipse 似乎缺少一些基本 sqlite3
类型。
我在所有以 sqlite3*
作为输入的函数上收到“无效参数”错误。
例如在 sqlite3_close
我得到
Invalid arguments
Candidates are: int sqlite3_close(*)
正确的原型(prototype)是
int sqlite3_close(sqlite3*)
所有 sqlite3_stmt
类型都会出现同样的问题。
我已经包含了 sqlite3.h
,它位于同一目录中,最后但并非最不重要的一点是,代码可以正常编译和运行。
我在这里错过了什么?
最佳答案
来自 sqlite3 代码,第 12450 行
** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
** is really a pointer to an instance of this structure.
struct Vdbe {
/*struct definition*/
}
也就是说,sqlite3_stmt 是一个forward declaration这会阻止用户创建 sqlite3_stmt 结构,而是使用 sqlite3 函数。
为了让 Eclipse CDT 识别 sqlite3_stmt,如果您不使用它进行编译,您可以将它作为一个符号添加到您的 Eclipse 项目属性中。
因为我不是,所以我将 sqlite3_stmt 定义为 Vdbe。
关于c - Sqlite3 结构未在 Eclipse 中解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20346754/