我正在尝试开始使用SQLite的C++ API.
#include <iostream>
#include <sqlite3.h>
using namespace std;
int main()
{
sqlite3 *db;
if (sqlite3_open("ex1.db", &db) == SQLITE_OK)
cout << "Opened db successfully\n";
else
cout << "Failed to open db\n";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
使用命令"g ++ main.cpp"进行编译会产生以下错误:
/tmp/ccu8sv4b.o: In function `main':
main.cpp:(.text+0x64): undefined reference to `sqlite3_open'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
什么可能出错?是不是在服务器中正确安装了sqlite3我正在编译它?