Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Error creating MySQL drivers for QT5.1(mysql.h no such file)
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 2 Posters 5.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    QVirus
    wrote on last edited by
    #1

    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)}

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        QVirus
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You need to download reimp yourself

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            QVirus
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved