PDA

View Full Version : QMYSQL driver not loaded error



mr.dct
31st March 2010, 14:38
I've got that error when trying to run a program so I've tried to look for the solution on the web, but I still don't get it fixed. So pls help me.
This is the code I've tried to find out the extractly error.

#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlError>
#include <QStringList>
#include <QtDebug>
int main(int argc, char *argv[])
{
QCoreApplication app( argc, argv );
qDebug() << QSqlDatabase::drivers();
QSqlDatabase db( QSqlDatabase::addDatabase( "QMYSQL" ) );
qDebug() << db.lastError();
}
And this is the result:


("QSQLITE")
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE
QSqlError(-1, "Driver not loaded", "Driver not loaded")

my .pro file is:


QT += sql
SOURCES += main.cpp

I've think i don't have the MySQL driver installed but I don't know how to install it.
I've tried to configure like following:

qmake "INCLUDEPATH+=-I/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro

and then run make but this is what it return:


../../../../include/QtCore/../../corelib/arch/qatomic_arch.h:88:4: error: #error "Qt has not been ported to this architecture"
.......
make: *** [.obj/release-shared/main.o] Error 1.

Anyone help me fix this error.
Thanks for your attentions.
P/S: if that is an uninstalled mysql driver error, please tell me how to install it in detail cause i'm totally newbie.

I'm using Redhat Enterprise, Qt 4.5.3 and MySQL 5

mr.dct
1st April 2010, 18:43
OK! My problem is fixed. It seems my install packet is error. I re-uncompress my qt packet, reconfigure and run qmake qmake install. It took approximately 3 hours to install and finally my program worked. Thanks alot