Looks like it's attempting to build an application instead of a library. I suggest you restore the original mysql.pro from the source package.
Looks like it's attempting to build an application instead of a library. I suggest you restore the original mysql.pro from the source package.
J-P Nurmi
Thanks for the reply Jpn. I have built driver several times and each time I did a brand new install of MySQL with the developer header files. This is the .pro files that comes with it:
This is the main.cpp in the Qt directoryTARGET = qsqlmysql
HEADERS = ../../../sql/drivers/mysql/qsql_mysql.h
SOURCES = main.cpp \
../../../sql/drivers/mysql/qsql_mysql.cpp
unix: {
isEmpty(QT_LFLAGS_MYSQL) {
!contains(LIBS, .*mysqlclient.*):!contains(LIBS, .*mysqld.*) {
use_libmysqlclient_r:LIBS *= -lmysqlclient_r
else:LIBS *= -lmysqlclient
}
} else {
LIBS *= $$QT_LFLAGS_MYSQL
QMAKE_CXXFLAGS *= $$QT_CFLAGS_MYSQL
}
}
win32:!contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*) {
LIBS *= -llibmysql
}
include(../qsqldriverbase.pri)
I googled the error and none of the results seem to point to main.cpp rather to a linker error. I am not sure how to go on#include <qsqldriverplugin.h>
#include <qstringlist.h>
#include "../../../sql/drivers/mysql/qsql_mysql.h"
class QMYSQLDriverPlugin : public QSqlDriverPlugin
{
public:
QMYSQLDriverPlugin();
QSqlDriver* create(const QString &);
QStringList keys() const;
};
QMYSQLDriverPlugin::QMYSQLDriverPlugin()
: QSqlDriverPlugin()
{
}
QSqlDriver* QMYSQLDriverPlugin::create(const QString &name)
{
if (name == QLatin1String("QMYSQL") || name == QLatin1String("QMYSQL3")) {
QMYSQLDriver* driver = new QMYSQLDriver();
return driver;
}
return 0;
}
QStringList QMYSQLDriverPlugin::keys() const
{
QStringList l;
l << QLatin1String("QMYSQL3");
l << QLatin1String("QMYSQL");
return l;
}
Q_EXPORT_STATIC_PLUGIN(QMYSQLDriverPlugin)
Q_EXPORT_PLUGIN2(qsqlmysql, QMYSQLDriverPlugin)
Exactly what commands did you invoke before 'mingw32-make'?
J-P Nurmi
Ok, first I went into the Qt directory and did "mingw32-make confclean".
I then reinstalled the latest MySQL with the headers to C:\MysQL.
Entered the C:\MySQL\lib\opt\ and ran the "reimp libmysql.lib" command to produce liblibmysql.a
Just a note, when I use the -d flag, I only get a libmysql.a file not a liblibmysql.a file ? Anyway I kept both in there.
Then I went into the C:Qt\4.3.4\src\plugins\sqldrivers\mysql and run the "qmake -o Makefile "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MySQL\lib\opt\liblibmysql.a" mysql.pro"
Then I ran the mingw32-make to build the .dll file. This command stopped due to errors, however I came across the libMySQL.dll file which I copied into C:\Qt\4.3.4\bin which is on the systems path.
I then went back into the Qt directory and did built Qt with mysql and even though building the driver failed I built Qt with the mysql configuration like this:
configure -qt-sql-mysql
mingw32-make
This time when I tried to connect to mysql using the application in the demo it actually worked. I have not had a chance to test out my own program yet.
Bookmarks