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. fatal error: mysql.h: No such file or directory
QtWS25 Last Chance

fatal error: mysql.h: No such file or directory

Scheduled Pinned Locked Moved Solved Installation and Deployment
12 Posts 5 Posters 9.6k Views
  • 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.
  • L Offline
    L Offline
    LeeH
    wrote on 27 Mar 2017, 23:33 last edited by LeeH
    #3

    Hi, and thanks for your response, and i will be sure to keep your advice in mind. I have solved my problem by going to Postgres, as the driver is already installed in release. Thanks so much for your response though!

    A 1 Reply Last reply 28 Mar 2017, 00:15
    0
    • L LeeH
      27 Mar 2017, 23:33

      Hi, and thanks for your response, and i will be sure to keep your advice in mind. I have solved my problem by going to Postgres, as the driver is already installed in release. Thanks so much for your response though!

      A Offline
      A Offline
      ambershark
      wrote on 28 Mar 2017, 00:15 last edited by
      #4

      @LeeH Silly reason to switch databases. But Postgres is good to use as well as mysql. Mysql is a quite a bit more powerful but if you don't need the power then postgres should be fine.

      Spaces in paths are the bane of my existence. They always cause issues like this. One of the reasons I hate windows so much. They seem to insist on large paths with spaces in them, all the while having massive path limitations (255 chars without special consideration and using the \?\ syntax).. It's just annoying.

      Anyway as @koahnig stated above it's pretty easy to fix since the problem is already identified. Just have to figure out the proper way to escape the spaces in the path. The double quoting suggested may work, or you may need 's. Assuming you even want to try mysql again, postgres should be fine unless you are aiming at enterprise level stuff, which I'm betting you're not.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      1
      • L Offline
        L Offline
        LeeH
        wrote on 31 Mar 2017, 10:58 last edited by
        #5

        @koahnig
        @ambershark

        Hi again, so I after trying postgres with pgAdmin, I decided that I really do want to continue with mysql and qt (i dunno call it preference) so the saga continues... XD

        Anyway I have fixed the original header file problem by reinstalling mysql to the root without spaces. I also installed the 32 bit version as I had previously installed 64 bit. It seemed to be building, but now I got this error telling me permision is denied to lib direcory:

        mingw32-make -f Makefile.Release all
        mingw32-make[1]: Entering directory 'C:/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/mysql'
        g++ -Wl,-s -shared -Wl,-subsystem,windows -Wl,--out-implib,C:\Qt\5.8\Src\qtbase\plugins\sqldrivers\libqsqlmysql.a -o ..\..\..\..\plugins\sqldrivers \qsqlmysql.dll .obj/release/qsql_mysql.o .obj/release/main.o .obj/release/moc_qsql_mysql_p.o  -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib C:\MySQL\MySQL_Server_5.7\lib -LC:\Qt\5.8\mingw53_32\lib C:\Qt\5.8\mingw53_32\lib\libQt5Sql.a C:\Qt\5.8\mingw53_32\lib\libQt5Core.a -llibmysql .obj\release\qsqlmysql_resource_res.o
        C:/Qt/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find C:\MySQL\MySQL_Server_5.7\lib: Permission denied
        C:/Qt/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql
        collect2.exe: error: ld returned 1 exit status
        Makefile.Release:65: recipe for target '..\..\..\..\plugins\sqldrivers\qsqlmysql.dll'  failed
        mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysql.dll] Error 1
        mingw32-make[1]: Leaving directory 'C:/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/mysql'
        Makefile:38: recipe for target 'release-all' failed
        mingw32-make: *** [release-all] Error 2
        

        I don't understand this because my windows account is admin level. I have run cmd as admin, tried setting lib path to environment variables, and checking permissions of folder. Any ideas?

        J 2 Replies Last reply 31 Mar 2017, 11:08
        0
        • L LeeH
          31 Mar 2017, 10:58

          @koahnig
          @ambershark

          Hi again, so I after trying postgres with pgAdmin, I decided that I really do want to continue with mysql and qt (i dunno call it preference) so the saga continues... XD

          Anyway I have fixed the original header file problem by reinstalling mysql to the root without spaces. I also installed the 32 bit version as I had previously installed 64 bit. It seemed to be building, but now I got this error telling me permision is denied to lib direcory:

          mingw32-make -f Makefile.Release all
          mingw32-make[1]: Entering directory 'C:/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/mysql'
          g++ -Wl,-s -shared -Wl,-subsystem,windows -Wl,--out-implib,C:\Qt\5.8\Src\qtbase\plugins\sqldrivers\libqsqlmysql.a -o ..\..\..\..\plugins\sqldrivers \qsqlmysql.dll .obj/release/qsql_mysql.o .obj/release/main.o .obj/release/moc_qsql_mysql_p.o  -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib C:\MySQL\MySQL_Server_5.7\lib -LC:\Qt\5.8\mingw53_32\lib C:\Qt\5.8\mingw53_32\lib\libQt5Sql.a C:\Qt\5.8\mingw53_32\lib\libQt5Core.a -llibmysql .obj\release\qsqlmysql_resource_res.o
          C:/Qt/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find C:\MySQL\MySQL_Server_5.7\lib: Permission denied
          C:/Qt/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql
          collect2.exe: error: ld returned 1 exit status
          Makefile.Release:65: recipe for target '..\..\..\..\plugins\sqldrivers\qsqlmysql.dll'  failed
          mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysql.dll] Error 1
          mingw32-make[1]: Leaving directory 'C:/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/mysql'
          Makefile:38: recipe for target 'release-all' failed
          mingw32-make: *** [release-all] Error 2
          

          I don't understand this because my windows account is admin level. I have run cmd as admin, tried setting lib path to environment variables, and checking permissions of folder. Any ideas?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 31 Mar 2017, 11:08 last edited by jsulm
          #6

          @LeeH said in fatal error: mysql.h: No such file or directory:

          -LC:\utils\postgresql\pgsql\lib C:\MySQL\MySQL_Server_5.7\lib

          First: why do you have PostgreSQL stuff there?
          Second: C:\MySQL\MySQL_Server_5.7\lib is just hanging around without any parameters, why? This way system tryes to execute this path, but since it is a directory it cannot be executed and you see that error message.

          -LC:\utils\postgresql\pgsql\lib C:\MySQL\MySQL_Server_5.7\lib
          

          How did you call configure?
          Are you trying to build from a clean state (looks like you're not)?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          3
          • L LeeH
            31 Mar 2017, 10:58

            @koahnig
            @ambershark

            Hi again, so I after trying postgres with pgAdmin, I decided that I really do want to continue with mysql and qt (i dunno call it preference) so the saga continues... XD

            Anyway I have fixed the original header file problem by reinstalling mysql to the root without spaces. I also installed the 32 bit version as I had previously installed 64 bit. It seemed to be building, but now I got this error telling me permision is denied to lib direcory:

            mingw32-make -f Makefile.Release all
            mingw32-make[1]: Entering directory 'C:/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/mysql'
            g++ -Wl,-s -shared -Wl,-subsystem,windows -Wl,--out-implib,C:\Qt\5.8\Src\qtbase\plugins\sqldrivers\libqsqlmysql.a -o ..\..\..\..\plugins\sqldrivers \qsqlmysql.dll .obj/release/qsql_mysql.o .obj/release/main.o .obj/release/moc_qsql_mysql_p.o  -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib C:\MySQL\MySQL_Server_5.7\lib -LC:\Qt\5.8\mingw53_32\lib C:\Qt\5.8\mingw53_32\lib\libQt5Sql.a C:\Qt\5.8\mingw53_32\lib\libQt5Core.a -llibmysql .obj\release\qsqlmysql_resource_res.o
            C:/Qt/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find C:\MySQL\MySQL_Server_5.7\lib: Permission denied
            C:/Qt/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibmysql
            collect2.exe: error: ld returned 1 exit status
            Makefile.Release:65: recipe for target '..\..\..\..\plugins\sqldrivers\qsqlmysql.dll'  failed
            mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlmysql.dll] Error 1
            mingw32-make[1]: Leaving directory 'C:/Qt/5.8/Src/qtbase/src/plugins/sqldrivers/mysql'
            Makefile:38: recipe for target 'release-all' failed
            mingw32-make: *** [release-all] Error 2
            

            I don't understand this because my windows account is admin level. I have run cmd as admin, tried setting lib path to environment variables, and checking permissions of folder. Any ideas?

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 31 Mar 2017, 11:11 last edited by
            #7

            @LeeH said in fatal error: mysql.h: No such file or directory:

            -llibmysql

            Also this is wrong:

            -llibmysql
            

            It must be:

            -lmysql
            

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            4
            • L Offline
              L Offline
              LeeH
              wrote on 31 Mar 2017, 13:25 last edited by LeeH
              #8

              @jsulm

              Hi

              First: I have no idea why postgres stuff is being used here, I wondered the same thing myself... and I had uninstalled postgres (through control panel) prior to my updated post but it never removed the folders

              Second: the call i make is as in my original post but without spaces and from the root:

              qmake "INCLUDEPATH+=C:/MySQL/MySQL_Server_5.7/include" "LIBS+=C:/MySQL/MySQL_Server_5.7/lib" mysql.pro
              

              I also tried to add libmysql.lib as it is in the lib directory:

              qmake "INCLUDEPATH+=C:/MySQL/MySQL_Server_5.7/include" "LIBS+=C:/MySQL/MySQL_Server_5.7/lib/libmysql.lib" mysql.pro
              
              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 31 Mar 2017, 21:39 last edited by
                #9

                Hi,

                Like @jsulm already wrote: your are missing the -L before the path to the lib folder for the LIBS variable.

                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
                2
                • L Offline
                  L Offline
                  LeeH
                  wrote on 31 Mar 2017, 23:59 last edited by LeeH 4 Jan 2017, 00:00
                  #10
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    LeeH
                    wrote on 1 Apr 2017, 10:46 last edited by
                    #11

                    Hi guys

                    Please ignore my last post I didn't understand what I needed to do for the lib folder. Thanks to @SGaist for clearing that up it has finally compiled without errors! I am new to this sort of thing and didn't really understand.

                    Thanks to all of you for your help!

                    1 Reply Last reply
                    1
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 1 Apr 2017, 19:29 last edited by
                      #12

                      You're welcome !

                      Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

                      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
                      1

                      12/12

                      1 Apr 2017, 19:29

                      • Login

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