且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Sqlite在Ubuntu上的Netbeans C ++中未定义引用`sqlite3_open'错误,将SQLite集成到Netbeans C ++ Ubuntu

更新时间:2023-02-08 10:56:59

在Linux上将Sqlite集成到Netbeans中$
2)Netbeans-> Your_Project Properties-> Linker-> Libraries-> Add Library-> libsqlite3.authorized
3)#include sqlite3.h

它工作!


I am trying to use Sqlite in my Netbeans C++ and following the tutorial here http://www.dreamincode.net/forums/topic/122300-sqlite-in-c/

When i build it,its giving me undefined reference to `sqlite3_open' and the other sqlite3 functions. I included the sqlite3.h too. What am i missing here?

When i added the linker to static library libsqlite3.a in project properties, my undefined reference errors are gone but now its giving me

/usr/lib/libsqlite3.a(sqlite3.o): In function pthreadMutexTry': /usr/lib/libsqlite3.a(sqlite3.o): In functionpthreadMutexAlloc': /usr/lib/libsqlite3.a(sqlite3.o): In function pthreadMutexAlloc': /usr/lib/libsqlite3.a(sqlite3.o): In functionpthreadMutexAlloc': /usr/lib/libsqlite3.a(sqlite3.o): In function unixDlError': /usr/lib/libsqlite3.a(sqlite3.o): In functionfindLockInfo': /usr/lib/libsqlite3.a(sqlite3.o): In function findLockInfo': /usr/lib/libsqlite3.a(sqlite3.o): In functionunixDlSym': /usr/lib/libsqlite3.a(sqlite3.o): In function unixDlClose': /usr/lib/libsqlite3.a(sqlite3.o): In functionunixDlOpen': collect2: ld returned 1 exit status make[2]: * [dist/Debug/GNU-Linux-x86/cddb] Error 1 make[1]: [.build-conf] Error 2 make: ** [.build-impl] Error 2

And if i include the sqlite3ext.h, I get main.cpp:20: error: ‘sqlite3_api’ was not declared in this scope

Integrating Sqlite into Netbeans on Linux
1)Synaptic Package Manager - Install libsqlite3-dev
2)Netbeans->Your_Project Properties->Linker->Libraries->Add Library-> libsqlite3.a
3)#include sqlite3.h
It works!