PDA

View Full Version : Loading QSQLite plugin under Windows: works, but... [SOLVED]



miwarre
11th November 2009, 10:08
Hello,

* Windows XP SP3;
* "Full" SDK 2009.04 installed (in D:\Dev\Qt\);
* developing a Qt application which uses the SQLite plugin.

So I added to the .pro:

QT += sql
QTPLUGIN += qslqlite

At compile, I got the error:

D:\Dev\Qt\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\.. \..\..\mingw32\bin\ld.exe: cannot find -lqsqlited

Looking at the last compiler command, I noticed:

g++ [...many options removed...],-subsystem,windows [...many object files removed...] -L"d:\Dev\Qt\qt\lib" -lmingw32 -lqtmaind -LD:/Dev/Qt/qt/plugins/sqldrivers -lqsqlited -lQtWebKitd4 -lQtSqld4 -lQtXmld4 -lQtGuid4 -lQtCored4


Now, the D:/Dev/Qt/qt/plugins/sqldrivers directory does NOT contain any qsqlited.dll file, but it DOES contain a qsqlited4.dll file!

So, I copied qsqlited4.dll to qsqlited.dll, recompiled and, lo! everything works.

Now, the question:

Is this supposed to work this way, by renaming a distribution file? May this trick have side effects? None surfaced so far, but I cannot be sure. Has anybody had similar experiences?

Thanks,
M.

wysota
11th November 2009, 11:50
You are trying to compile your application in debug mode while you only have the plugin in release mode. Apart from that you are linking with the plugin which doesn't make much sense. You needn't do that. Just build your app in release mode after you remove the QTPLUGIN+=sqlite line and your app should work just fine and load the plugin when you initialize the application object.

AD
11th November 2009, 12:33
Thanks for this answer! ))):)

miwarre
11th November 2009, 14:24
You are trying to compile your application in debug mode while you only have the plugin in release mode.
Not really: qsqlited4.dll is debug.

Apart from that you are linking with the plugin which doesn't make much sense. You needn't do that. Just build your app in release mode after you remove the QTPLUGIN+=sqlite line and your app should work just fine and load the plugin when you initialize the application object.
YES!!

I thought the QTPLUGIN+=... .pro line was required to dynamically load the plugin, while the Q_IMPORT_PLUGIN(...) macro in the code triggered the (static) linking. At least, this is what I grasped from the docu...

Anyway, it works without messing with file names. Thanks!

M.