PDA

View Full Version : Statically compiled Qt 4.1.4 and mySql



Djony
25th January 2007, 20:08
Hi! I ve searched all forum, and tried a lot of things, but didn't solve my problem. I have no hope but to post here. I have statically compiled Qt 4.1.4. which I use with Mingw. I need to build application which previosly worked fine with SQLITE database to work with MYSQL database. This is what I've tried so far.
I've found mysql-noinstall-5.0.27-win32
went to it's lib/opt directory and did:
reimp -d libmysql.lib
dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a

cd c:\Qt\4.1.4 //obviously, i am using qt 4.1.4
configure -plugin-sql-mysql -I C:\mysql\INCLUDE //C:\mysql is where I put my mysql directory
then went to

cd c:\qt\4.1.4\src\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=C:\mysql\INCLUDE " "LIBS+=-LC:\mysql\LIB\OPT -lmysql" mysql.pro
But I still get "mysql driver not loaded" or something like that.
Now, qoogling all over the internet I have found that i need to put some more options to my .pro file because I have statically compiled Qt. But, because my application is consisted of two projects (one, "dbm" library and "importer" application) i've puted in both pro files QTPLUGIN += qsqlmysql option. Each project has one class. Above constructors of those classes, I've put: Q_IMPORT_PLUGIN(qsqlmysql)
(Btw, for all those options read here: http://doc.trolltech.com/4.2/plugins-howto.html#static-plugins). Maybe I did something wrong here, don't really know, these are all shots from the hip. When I compile my "dbm" library it all goes fine. But when I compile my application I get this error:

L"c:\Qt\4.1.4\lib" -lmingw32 -lqtmaind -lQtSqld4 -lQtXmld4 -lQtGuid4 -lQtCored4 -LC:\Qt\4.1.4\plugins/sqldrivers/ -lqsqlmysqld
./debug\Importer.o(.text$_ZN29StaticqsqlmysqlPluginI nstanceC1Ev[StaticqsqlmysqlPluginInstance::StaticqsqlmysqlPlug inInstance()]+0x9): In function `ZSt14__copy_trivialIP19TestProgramLocationEPT_PKS 2_S5_S3_':
C:/MinGW1/bin/../lib/gcc/i686-pc-mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_algobase.h: undefined reference to `qt_plugin_instance_qsqlmysql()'
collect2: ld returned 1 exit statusAnd I don't have a clue what that really means :)
So, can anybody help me? Can anybody say to me what have I done wrong? What I need to do, to have my mysgl driver built and included so I can use it?
If my post looks confusing to you, ask me what you want me to clarify, because I am clueless. I would be very grateful for any idea. Thank you in advance.

e8johan
26th January 2007, 08:13
Have you looked at this wiki page? http://wiki.qtcentre.org/index.php?title=Building_the_QMYSQL_plugin_on_Wind ows_using_MinGW

Also, it is likely to be a problem with the plug-in cache - you can find a link to info about that at the bottom of the wiki page referred to above.