Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error creating MySQL drivers for QT5.1(mysql.h no such file)



  • Hi.
    I'm trying create the drivers for MySQL to connect to QT5.1. Below is my set-up process and the error that it picks up, mysql.h no such file.

    Setting up environment for Qt usage...

    C:\Qt51\5.1.0\mingw48_32>set mysql=C:\Program Files (x86)\MySQL\MySQL Server 5.5

    C:\Qt51\5.1.0\mingw48_32>cd C:\Qt51\5.1.0\Src\qtbase\src\plugins\sqldrivers\mysq
    l

    C:\Qt51\5.1.0\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mysql
    server 5.5%\include" "LIBS+=%mysql server 5.5%\lib\libmysql.lib" -o Makefile
    mysql.pro

    C:\Qt51\5.1.0\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make
    mingw32-make -f Makefile.Release all
    mingw32-make[1]: Entering directory 'C:/Qt51/5.1.0/Src/qtbase/src/plugins/sqldri
    vers/mysql'
    g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -W
    all -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCE
    PTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I"%mysql" -I"se
    rver" -I"5.5%\include" -I"C:\Qt51\5.1.0\mingw48_32\include" -I"C:\Qt51\5.1.0\min
    gw48_32\include\QtSql" -I"C:\Qt51\5.1.0\mingw48_32\include\QtSql\5.1.0" -I"C:\Qt
    51\5.1.0\mingw48_32\include\QtSql\5.1.0\QtSql" -I"C:\Qt51\5.1.0\mingw48_32\inclu
    de\QtCore" -I"C:\Qt51\5.1.0\mingw48_32\include\QtCore\5.1.0" -I"C:\Qt51\5.1.0\mi
    ngw48_32\include\QtCore\5.1.0\QtCore" -I".moc\release_shared" -I"........\mks
    pecs\win32-g++" -o .obj\release_shared\main.o main.cpp
    In file included from main.cpp:44:0:
    ../../../sql/drivers/mysql/qsql_mysql_p.h:63:19: fatal error: mysql.h: No such f
    ile or directory
    #include <mysql.h>
    ^
    compilation terminated.
    Makefile.Release:497: recipe for target '.obj/release_shared/main.o' failed
    mingw32-make[1]: *** [.obj/release_shared/main.o] Error 1
    mingw32-make[1]: Leaving directory 'C:/Qt51/5.1.0/Src/qtbase/src/plugins/sqldriv
    ers/mysql'
    makefile:38: recipe for target 'release-all' failed
    mingw32-make: *** [release-all] Error 2

    C:\Qt51\5.1.0\Src\qtbase\src\plugins\sqldrivers\mysql>

    The mysql.h file is located in, C:\Program Files (x86)\MySQL\MySQL Server 5.5\include folder.

    What I'm I doing wrong? Is something missing?
    {I have Win7 64 bit, MySQL Server5.5 (32bit) & QT5.1 with Qt Creator 2.72 (32Bit)}


  • Lifetime Qt Champion

    Hi and welcome to devnet

    "Here":http://qt-project.org/doc/qt-4.8/sql-driver.html#qmysql you have the instruction to build the plugin (although it's for Qt 4.8 the same applies to Qt 5)

    To simplify things, you should rather install MySql in a path without space.

    Hope it helps



  • I’ve worked through the “ How to build the MySQL driver for MinGW users” procedure.
    When I type in reimp -d libmysql.lib I get the error: 'reimp-d' is not recognized as an internal or external command,operable program or batch file.
    I’ve rename MySQL as MySQL55
    I’ve also noticed that I do not have a opt folder in the C:\Program Files (x86)\MySQL\MySQL55\lib folder.


  • Lifetime Qt Champion

    You need to download reimp yourself

    The MySQL installation folders might have changed a bit. You should only consider the files using their names



  • Hi. Do you know of a source to dowbload reimp. I 've tried many links on google but unsuccessfull in download the full file


Log in to reply