Hello everybody,
I'm trying to install the MySQL drivers for Qt on Windows 7.
I have already installed MinGW, Qt, QtCreator, MySQL connector and MySQL Server. I'm following the steps in doc "SQL Database Drivers" which comes in QtCreator.
The steps are:
- Install MinGW-5.1.6.exe in, e.g. C:\MinGW.
- Extract mingw-utils-0.3.tar.gz into, e.g. C:\MinGW.
- Add the path for MinGW-5.1.6.exe to your PATH variable, e.g. C:\MinGW\bin;
- Extract the Qt sources, (qt-everywhere-opensource-src-4.6.2.zip), into, e.g. C:\Qt.
- Add the path for the eventual Qt binary to your PATH variable, e.g. C:\Qt\4.6.2\bin;.
- Install MySQL (mysql-5.1.35-win32.msi), customizing the components. Select only the headers and libraries. Install in, e.g. C:\MySQL\MySQL51.
- Open the DOS prompt, go to C:\MySQL\MySQL51\lib\opt, and run the following commands:
reimp -d libmysql.lib
dlltool -k -d libmysql.def -l libmysql.a
- Open the DOS prompt, go to C:\Qt\4.6.2 and run the following commands:
configure.exe -debug-and-release -platform win32-g++ -qt-sql-mysql -l mysql -I C:\MySQL\MySQL51\include -L C:\MySQL\MySQL51\lib\opt
mingw32-make sub-src
This step takes a long time.
- Open the DOS prompt, go to C:\Qt\4.6.2\src\plugins\sqldrivers\mysql and run the following command:
qmake "INCLUDEPATH+=C:\MySQL\MySQL51\include" "LIBS+=-L. mysql" mysql.pro
- Now the following libraries are ready in C:\Qt\4.6.2\plugins\sqldrivers.
libqsqlmysql4.a
libqsqlmysqld4.a
qsqlmysql4.dll
qsqlmysqld4.dll
- To use the SDK and QtCreator directly, copy these libraries to your C:\Qt\...\qt\plugins\sqldrivers\, and copy C:\MySQL\MySQL51\lib\opt\libmysql.dll to your C:\Qt\...\qt\bin\.
In step configure.exe and mingw32 an error occurs in a file claiming qsql_mysql.h.
Then inside that file has an include that does not exist, mysql.h. Then I copy the mysql.h that comes with the MySQL server and continue the problem.
What the solution?
Added after 57 minutes:
I tried with the mysql binary files and still continue the problem.
In step mingw32 show:
C:\Qt\2010.05\qt\src\sql/drivers/mysql/qsql_mysql.cpp:312: undefined reference to `mysql_stmt_errno@4'
./tmp\obj\debug_shared\qsql_mysql.o:C:\Qt\2010.05\qt \src\sql/drivers/mysql/qsql_mysql.cpp:358: undefined reference to `mysql_stmt_result_metadata@4'
...
when do the qmake,
C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql>qmak e "INCLUDEPATH+=C:\mysql-connector-c-noinstall-6.0.2-winx64\include" "LIBS+=-L. mysql" mysql.pro
show:
WARNING: (internal):1: Unescaped backslashes are deprecated.
WARNING: (internal):1: Unescaped backslashes are deprecated.
WARNING: (internal):1: Unescaped backslashes are deprecated.
In the C:\Qt\...\plugins\sqldrivers no have files qsqlmysql4.dll, qsqlmysqld4.dll.
Bookmarks