How to install MySql driver plugin in QT SDK 4.7 (2010.05)?
-
Just for clarification: I suppose that you do all steps 1-7 from your instruction above with changes in according to my post.
mingw used for SDK build is not important to you, only Qt. Try to recompile Qt from sources. On modern PC it takes not more than 2 hours. You can pass to configure.exe the switches to include mysql plugin.
Probably, it is better to download qt sources separately and build them in other directory. After that just tell QtCreator what Qt version should be used.
-
OK, blex. I'll try your idea first and if it doesn't fix the problem I will try downloading qt sources separately and build them. I will let you know the result.
Only another question: how can I tell QtCreator what Qt version should be used?
Thanks a lot for your time.
-
[quote author="blueyes" date="1291357867"]Only another question: how can I tell QtCreator what Qt version should be used?[/quote]
Anfortunately, I have localized UI on my PC, so, maybe English menus are slightly different: use Tools - Options - Qt4 - Qt versions
-
I've updated the article from "pikopong":http://www.pikopong.com/blog/2010/04/11/how-to-enable-mysql-support-in-qt-sdk-for-windows/ with some additional information. But the guide still works, I've tested it in my Virtual Box with a clean Windows XP (never install Qt or MySQL before in it). You can see the full build process "here":http://pastie.org/1348501
-
The problem aurorius is, as I already said before, that this way I can build the driver but NOT the test application:
@#include <QtGui/QApplication>
#include <QCoreApplication>
#include <QDebug>
#include <QtSQL/QSqlDatabase>
#include "mainwindow.h"int main(int argc, char *argv[])
{
QApplication a(argc, argv);
qDebug() << QSqlDatabase::drivers();return a.exec();
}@
Here are the errors I got:
@Running build steps for project SqlTest...
Configuration unchanged, skipping qmake step.
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\SqlTest.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -L"c:\Qt\2010.05\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'
mingw32-make: Leaving directory `C:/Paolo/QtPtojects/SqlTest-build-desktop'
debug/main.o: In function `Z5qMainiPPc':
C:\Paolo\QtPtojects\SqlTest-build-desktop/../SqlTest/main.cpp:10: undefined reference to '_imp___ZN12QSqlDatabase7driversEv'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\SqlTest.exe] Error 1
mingw32-make: *** [debug] Error 2
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project SqlTest (target: Desktop)
When executing build step 'Make'@ -
Just in case if you're wondering, this is the compile output for a working project
@Running build steps for project testmysql...
Configuration unchanged, skipping qmake step.
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\2010.05\qt\include\QtCore" -I"c:\Qt\2010.05\qt\include\QtSql" -I"c:\Qt\2010.05\qt\include" -I"c:\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"..\testmysql" -I"." -I"c:\Qt\2010.05\qt\mkspecs\win32-g++" -o debug\main.o ..\testmysql\main.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -mthreads -Wl -o debug\testmysql.exe debug/main.o -L"c:\Qt\2010.05\qt\lib" -lQtSqld4 -lQtCored4
mingw32-make[1]: Leaving directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'
mingw32-make: Leaving directory `C:/Documents and Settings/root/My Documents/Projects/testmysql-build-desktop'
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited normally.@
-
Eventually I've been able to figure out why it didn't build: I had to manually add to the .pro file the SQL module.
QT += core gui sql
Now it works!
Many thanks again for the support.
-
[quote author="blueyes" date="1291600372"]Eventually I've been able to figure out why it didn't build: I had to manually add to the .pro file the SQL module.
QT += core gui sql
Now it works!
Many thanks again for the support.[/quote]
Next time read proper documentation. Paragraph modules. where write such "if you using sql write QT += sql", "If you using GUI, write QT += gui", etc..
-
hi all...
I am using ubuntu OS ..and I install Qt via downloading it from QT center.When I wrote this code I found only one driver that is "QSQLITE".
so how to install that I can work with QMYSQL driver -
You've got to configure an build Qt with the QMYSQL Database driver enabled.