
Originally Posted by
wysota
Do you have a static installation of Qt? If not, you don't need Q_IMPORT_PLUGIN or the changes to the project file, just follow the article in our wiki about enabling MySQL support for Qt.
have a shared installation, so a solution using q_import_plugin is obsolete
so I tried the followin steps:
1.)
- followed the article the wiki about enabling MySQL support link
did exactly as in the description:
- compiles fine, qsqlmysql.dll is created, qsqlmysql.dll and libqsqlmysql.a files are in the %QTDIR%/plugins/ directory
- copied libmysql.dll file from the MySQL installation's bin directory to %QTDIR%/bin
result --> QSqlDatabase: QMYSQL driver not loaded
2.)
after that i decided to install & compile everything from scratch:
- installed new mysql-5.0.41-win32 server
- downloaded qt-win-opensource-src-4.2.3.zip & acs-4.2.3-patch1.zip (visual studio patch)
then proceeded exactly as in the "Qt4 with Visual Studio" tutorial link
following qt compile configuration
qconfigure msvc.net -prefix C:\qt4shared -qt-sql-mysql -I C:\mysql\include -L C:\mysql\lib\opt
qconfigure msvc.net -prefix C:\qt4shared -qt-sql-mysql -I C:\mysql\include -L C:\mysql\lib\opt
To copy to clipboard, switch view to plain text mode
during compilation an error occurs while creating the qtsqld4.dll with the following error:

if i do not use the -qt-sql-mysql flag everything finishes fine, but i do not have mysql support.
3.)
tried another attempt with a fresh compiled qt (without -qt-sql-mysql flag) and proceeded as in the wiki about enabling MySQL support link
but the result still is the same --> QSqlDatabase: QMYSQL driver not loaded
following questions arise:
- is the mysql-5.0.41-win32 server not compatible with qt 4.2.x ?
- is the acs-4.2.3-patch1.zip (visual studio patch) flawed at some script?
the patch modifies the src/sql/sql.pro file:
original:
TARGET = QtSql
QPRO_PWD = $$PWD
QT = core
DEFINES += QT_BUILD_SQL_LIB
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000
include(../qbase.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SQL_P = sql
include(kernel/kernel.pri)
include(drivers/drivers.pri)
include(models/models.pri)
TARGET = QtSql
QPRO_PWD = $$PWD
QT = core
DEFINES += QT_BUILD_SQL_LIB
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000
include(../qbase.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SQL_P = sql
include(kernel/kernel.pri)
include(drivers/drivers.pri)
include(models/models.pri)
To copy to clipboard, switch view to plain text mode
modified:
TARGET = QtSql
QPRO_PWD = $$PWD
QT = core
DEFINES += QT_BUILD_SQL_LIB
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000
win32-borland:QMAKE_LFLAGS += /b:0x62000000
include(../qbase.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SQL_P = sql
include(kernel/kernel.pri)
include(drivers/drivers.pri)
include(models/models.pri)
TARGET = QtSql
QPRO_PWD = $$PWD
QT = core
DEFINES += QT_BUILD_SQL_LIB
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000
win32-borland:QMAKE_LFLAGS += /b:0x62000000
include(../qbase.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SQL_P = sql
include(kernel/kernel.pri)
include(drivers/drivers.pri)
include(models/models.pri)
To copy to clipboard, switch view to plain text mode
maybe somebody can figure out more ???

Originally Posted by
patrik08
Visual studio have to much option and button ... and confusion ...
I have all two compiler on two pc ... but 90% i work only on mingw ... is more easy...
I don't think its that bad, an I'm used to it.
And until now I had no prob using QT in Visual studio...
Bookmarks