'sqlite3_api' was not declared in this scope

泄露秘密 提交于 2019-12-04 05:24:59

问题


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!!


回答1:


Instead of

#include <sqlite3ext.h> 

write

#include <sqlite3.h> 

The sqlite3ext.h file is only needed if you are going to write an SQLite extension - a custom function, for example. For regular database access, use sqlite3.h.



来源:https://stackoverflow.com/questions/11229862/sqlite3-api-was-not-declared-in-this-scope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!