[Qt-interest] SQLite: no functions are exported

Robert Hairgrove evorgriahr at hispeed.ch
Fri Feb 25 17:37:42 CET 2011


On Fri, 2011-02-25 at 17:03 +0100, Thiago Macieira wrote:
> Em sexta-feira, 25 de fevereiro de 2011, às 16:51:47, Robert Hairgrove 
> escreveu:
> > So is there some other mechanism which can expose the functions exported
> > from the plugin .so, but avoid having two instances of SQLite in my app
> > and still be able to take advantage of the QtSql functionality?
> 
> Link to the plugin.
> 
> Or, better yet, why don't you link to the sqlite library?

Thanks for the response. Here is what I have tried so far:

(1) The Qt SQLite plugin is built and located in the normal place. I
add:
    QT += core sql
to my project file. I #include "sqlite3.h" from the 3rdparty/sqlite
folder in Qt sources. Compilation works, but the linker complains when I
call "sqlite3_vfs_find()" in my code: "In function 'main': undefined
reference to `sqlite3_vfs_find'".

(2) I added this line to my project file and did a clean followed by
"rebuild all" (in QtCreator):
 unix:LIBS += -L/usr/local/Trolltech/Qt-4.7.1/plugins/sqldrivers -lqsqlite

Now I get no linker error, but instead I get this runtime error:
"Error while loading shared libraries: libqsqlite.so: cannot open shared
object file: No such file or directory".

I'm a little wary about linking directly to the SQLite library ... how
would I do this? It isn't safe to have both the plugin AND the sqlite3.c
source in my application because then I have two instances of the
library with all of the potential problems in memory allocation, etc.





More information about the Qt-interest-old mailing list