“sqlite3_api”没有在这个范围内声明('sqlite3_api' was

2019-07-30 03:54发布

I've been learning sqlite3 programming in C++ for the first time and this error confounds me and my internet searching abilities.

Here is my code, as far as it gets before throwing an error.

#include <iostream>
#include <sqlite3ext.h>

using namespace std;

int main()
{
    sqlite3 *database;
    int check;

    check = sqlite3_open("introdb3.db", &database); //error is here
}

I'm pretty sure that it has something to do with the libraries that are (or aren't) being linked, but I can't figure out how to make it go properly.

I'm on Ubuntu using code::blocks.

Thanks!!

Answer 1:

代替

#include <sqlite3ext.h> 

#include <sqlite3.h> 

sqlite3ext.h自定义函数,例如-如果你打算写一个SQLite扩展时,才需要文件。 对于常规的数据库访问,使用sqlite3.h



文章来源: 'sqlite3_api' was not declared in this scope