本文介绍了Sqlite在Ubuntu上的Netbeans C ++中未定义引用`sqlite3_open'错误,将SQLite集成到Netbeans C ++ Ubuntu的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的Netbeans C ++中使用Sqlite,并按照这里的教程



当我构建它,它给我未定义的引用`sqlite3_open'和其他sqlite3函数。我也包括了sqlite3.h。我在这里失踪了什么?



当我在项目属性中添加链接器到静态库libsqlite3.a时,我的未定义的引用错误消失了,但现在它给了我



/usr/lib/libsqlite3.a(sqlite3.o):在函数 pthreadMutexTry':
/usr/lib/libsqlite3.a(sqlite3。 o):in function
pthreadMutexAlloc':
/usr/lib/libsqlite3.a(sqlite3.o):在函数 pthreadMutexAlloc':
/ usr /lib/libsqlite3.a(sqlite3.o):在函数
pthreadMutexAlloc':
/usr/lib/libsqlite3.a(sqlite3.o):在函数 unixDlError':
/usr/lib/libsqlite3.a(sqlite3.o):在函数
findLockInfo':
/usr/lib/libsqlite3.a(sqlite3.o) :在函数 findLockInfo':
/usr/lib/libsqlite3.a(sqlite3.o):在函数
unixDlSym':
/ usr / lib /libsqlite3.a(sqlite3.o):在函数 unixDlClose':
/usr/lib/libsqlite3.a(sqlite3.o):在函数
unixDlOpen' :
collect2:ld返回1退出状态
make [2]: * [dist / Debug / GNU-Linux-x86 / cddb]错误1
make [1] em>
错误2
错误2
[.build-conf]

如果我包括sqlite3ext.h,我得到

main.cpp:20:error:'sqlite3_api'没有声明在这个范围

解决方案

在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 herehttp://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 statusmake[2]: * [dist/Debug/GNU-Linux-x86/cddb] Error 1make[1]: [.build-conf] Error 2make: ** [.build-impl] Error 2

And if i include the sqlite3ext.h, I getmain.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!

这篇关于Sqlite在Ubuntu上的Netbeans C ++中未定义引用`sqlite3_open'错误,将SQLite集成到Netbeans C ++ Ubuntu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 22:41