PDA

View Full Version : undefined reference to QMYSQLDriver



Naraha
21st December 2011, 16:29
I want to create a connection to an existent MySQL Server. I have already tested if have support and I have. Everything is in the right folder. And in case it’s important, I’m using the Qt Creator with Qt 4.7 on Ubuntu. I really hope someone here can help me.
Thank you in anticipation!

Here’s my code:

#include <QtGui/QApplication>
#include <QtSql/QSqlDatabase>
#include <QtSql/QMYSQLDriver>
#include <QtSql/QtSql>
#include <QMessageBox>

bool createConnection(){ QSqlDatabase db = QSqlDatabase::addDatabase(“QMYSQL”);
db.setHostName(“edu.uni-ulm.de”);
db.setDatabaseName(“config”);
db.setPort(1234);
db.setUserName(“gbatstone”);
db.setPassword(“Hiddsg44”);
if (!db.open()){
QMessageBox::critical(0, QObject::tr(“Database Error”), db.lastError().text());
return false;
}
return true; }

int main(int argc, char *argv[])
{ QApplication a(argc, argv);
if (!createConnection()) return 1;
return a.exec();
}

The .pro file:

QT += core gui
QT += sql
TARGET = Test
TEMPLATE = app
SOURCES += main.cpp
HEADERS += ../../../../../../usr/include/qt4/QtSql/qsql_mysql.h \ ../../../../../../usr/include/mysql/mysql.h
INCLUDEPATH += “/usr/include/mysql/” \ “/usr/include/qt4/QtSql/”
LIBS+=”-L/usr/lib/mysql”

And the complete error message:
/home/melanie/Desktop/Workspace/Qt Test/Test-build-desktop/moc_qsql_mysql.cpp:73: error: undefined reference to `QMYSQLDriver::isIdentifierEscapedImplementation(Q String const&, QSqlDriver::IdentifierType) const’

amleto
21st December 2011, 18:19
have you built the qt sql driver?

maybe help here http://developer.qt.nokia.com/forums/viewthread/7794

or here http://developer.qt.nokia.com/search/tag/mysql