Qt 4.8.5 + MySQL + Windows
-
Hi everybody,
I'm sorry to post a so simple question but I'm new to MySQL and compiling stuff.
So I follow "these instructions":https://qt-project.org/doc/qt-4.7/sql-driver.html to build the QMYSQL plugin on Windows.
I adapt the instruction like this (for my setup) :
- set QMAKESPEC=C:\Qt\4.8.5\mkspecs\win32-msvc2010
- cd C:\Qt\4.8.5\src\plugins\sqldrivers\mysql
- c:/qt/4.8.5/qmake/qmake "INCLUDEPATH+=C:/Program Files/MySQL/MySQL Server 5.6/include" "LIBS+=C:/Program Files/MySQL/MySQL Server 5.6/lib/libmysql.lib" mysql.pro
until now I have no problem...
When I call nmake like this :
- "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"
I got this error message :
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. Tous droits réservés."C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe" -f Makefile.Release
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. Tous droits réservés.C:\iwmake\build_vs2010_opensource_________________PADDING_________________\bin\moc.exe -DUNICODE -DWIN32
-DQT_NO_CAST_TO_ASCII
-DQT_NO_CAST_FROM_ASCII
-DQT_NO_DEBUG
-DQT_PLUGIN
-DQT_SQL_LIB
-DQT_CORE_LIB
-DQT_THREAD_SUPPORT
-DQT_NO_DYNAMIC_CAST
-DNDEBUG
-I"c:\iwmake\build_vs2010_opensource_________________PADDING_________________\include\QtCore"
-I"c:\iwmake\build_vs2010_opensource_________________PADDING_________________\include\QtSql"
-I"c:\iwmake\build_vs2010_opensource_________________PADDING_________________\include"
-I"c:\Program"
-I"Files\MySQL\MySQL"
-I"Server"
-I"5.6\include"
-I"c:\iwmake\build_vs2010_opensource_________________PADDING_________________\include\ActiveQt"
-I"release"
-I"........\mkspecs\win32-msvc2010"
-D_MSC_VER=1600
-DWIN32 ......\sql\drivers\mysql\qsql_mysql.cpp -o release\qsql_mysql.moc
The system cannot find the path specified.
NMAKE : fatal error U1077: 'C:\iwmake\build_vs2010_opensource_________________PADDING_________________\bin\moc.exe' : code retour '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"' : code retour '0x2'
Stop.
I'm sorry for some part of the message in french.
In fact, I do not understand what is all the "c:\iwmake\build_vs2010_opensource_________________PADDING_________ ..."
I have no folder named c:\iwmakeIt's my first time using qmake & nmake.
I will appreciate any inputs. Thanks in advance!
-
Hi and welcome to devnet,
First thing to do install reinstall MySQL in a path without space or use the old 8.3 format to give the library path then try again.
You can also find numerous posts about this subject that might help you on this forum
Hope it helps
-
Thanks for the reply,
I did what you proposed (removed & reinstalled MySQL with 8.3 format name) but I get the same error.
I look for a post to help me but I found nothing helpful. May be it's my lack of knowledge that prevent me to found something.
Any suggestion from this...
If anyone understand the meaning of the previous error message, that will be really appreciated.
-
Hi, I suggest to follow this tutorial "Qt5 MYSQL Win7":http://seppemagiels.com/blog/create-mysql-driver-qt5-windows
-
I didn't suggest to install it using 8.3 names, just in a path without spaces. If you wanted to keep your original installation, you would have need to use the 8.3 notations.
Where do you have your MySQL installed now ?
-
I follow the steps in this tutorial ("Create MySQL driver for Qt on Windows":http://seppemagiels.com/blog/create-mysql-driver-qt-windows) and I adapt some of it for my situation :
-
Qt 4.8.5
-
Microsoft Visual Studio 2010
-
I also installed MySQL 5.5 32bits
-
then I followed this steps : run the following commands from the Qt Command Prompt
-
set mysql=C:\PROGRA~2\MySQL\MYSQLS~1.5
-
cd C:\Qt\4.8.5\src\plugins\sqldrivers\mysql
-
qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile mysql.pro
-
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"
-
qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile mysql.pro "CONFIG+=release"
-
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\nmake.exe"
At this point, everything seem to go well. Thanks to you both.
From now I copy the following to C:\Qt\4.8.5\plugins\sqldrivers
-
qsqlmysql4.dll + qsqlmysql4.lib (from C:\Qt\4.8.5\src\plugins\sqldrivers\mysql\release)
-
qsqlmysqld4.dll + qsqlmysqld4.lib (from C:\Qt\4.8.5\src\plugins\sqldrivers\mysql\debug)
Also copying
C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib\libmysql.dll
to
C:\Qt\4.8.5\bin
From this, I was sure it should work!
But I got a strange behavior, when I run this command :
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "my_sql_db");
I got this output :
...
'Database01.exe' : Chargé 'C:\Qt\4.8.5\plugins\sqldrivers\qsqlmysqld4.dll', Les symboles ont été chargés.
'Database01.exe' : Déchargé 'C:\Qt\4.8.5\plugins\sqldrivers\qsqlmysqld4.dll'
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL7 QPSQL
...
I'm sorry for the french part again (Chargé mean loaded) and (Déchargé mean unloaded).
Now, do somebody know why the driver seem to load and unload immediately after?
Thanks again!
-
-
Did you check what lastError() returns ?
-
I didn't check, thanks.
The return is
driverError = "Driver not loaded"
databaseError = "Driver not loaded"
errorType = ConnectionError
errorNumber = -1This is interesting, but it doesn't explain why the driver seems to load and right after it is unloaded.
Thanks for your help...