Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. "Cannot find file: mysql.pro" while building MySQL driver in Qt
Forum Updated to NodeBB v4.3 + New Features

"Cannot find file: mysql.pro" while building MySQL driver in Qt

Scheduled Pinned Locked Moved Solved General and Desktop
34 Posts 6 Posters 10.8k Views 2 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.
  • C CrowSun
    29 Jan 2018, 01:51

    Hello everyone. I'm totally frustrated after tonns of tries on making connection between Qt and MySQL. I reinstalled both of them for many times and I saw different types of errors while I was trying to make connection MySQL&Qt. Right now I have such situation.
    I enter such commands in cmd
    C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql>qmake "INCLUDEPATH+=C:\MySQL-insalldir\MySQL Server 5.7\include" "LIBS+=C:\MySQL-insalldir\MySQL Server 5.7\lib\libmysql.lib" mysql.pro

    and i'm getting such error:
    Cannot find file: mysql.pro.

    I have all the pathes environment variables and i'm stucked on what I'm actually doing wrong.
    Please, help me.

    J Offline
    J Offline
    jsulm
    Lifetime Qt Champion
    wrote on 29 Jan 2018, 05:56 last edited by
    #2

    @CrowSun said in "Cannot find file: mysql.pro" while building MySQL driver in Qt:

    C:\MySQL-insalldir\MySQL Server 5.7

    You actually need the path to MySQL client library, not the server.
    Does C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql contain mysql.pro?

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

    C 1 Reply Last reply 29 Jan 2018, 19:16
    2
    • C Offline
      C Offline
      CrowSun
      wrote on 29 Jan 2018, 12:37 last edited by
      #3

      Can you please clarify where MySQL client library usually locates? I made everything as in docs and Installer puts in installation and data folders a folder named MySQL Server. So all needed libs (such as "...\include" and libmysql.lib) are located in that directives.
      And yes, there is no mysql.pro in " C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql" and that was also strange to me, because in my previous installation that path definitely contained that file. But it was another strange error which pushes me to reinstall Qt and MySQL. And now I get that error, that I described in the topic.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 29 Jan 2018, 16:43 last edited by
        #4

        Hi
        Just a note/question.
        If you do not select the source part in the installer. Will
        the mysql.pro be there ?
        alt text

        1 Reply Last reply
        1
        • J jsulm
          29 Jan 2018, 05:56

          @CrowSun said in "Cannot find file: mysql.pro" while building MySQL driver in Qt:

          C:\MySQL-insalldir\MySQL Server 5.7

          You actually need the path to MySQL client library, not the server.
          Does C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql contain mysql.pro?

          C Offline
          C Offline
          CrowSun
          wrote on 29 Jan 2018, 19:16 last edited by
          #5

          @jsulm I forgot to reply on you message, when I answered to you.

          J 1 Reply Last reply 30 Jan 2018, 05:52
          0
          • C CrowSun
            29 Jan 2018, 19:16

            @jsulm I forgot to reply on you message, when I answered to you.

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 30 Jan 2018, 05:52 last edited by
            #6

            @CrowSun https://dev.mysql.com/downloads/connector/c/

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

            C 1 Reply Last reply 30 Jan 2018, 23:22
            0
            • J jsulm
              30 Jan 2018, 05:52

              @CrowSun https://dev.mysql.com/downloads/connector/c/

              C Offline
              C Offline
              CrowSun
              wrote on 30 Jan 2018, 23:22 last edited by
              #7

              @jsulm I already have mysql connector. It was installed into Program Files folder by default. Actually installer doesnt even offers me choice of path. But, I tried that one:
              C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql>qmake "INCLUDEPATH+=C:\Program Files\MySQL\MySQL Connector C 6.1\include" "LIBS+=C:\Program Files\MySQL\MySQL Connector C 6.1\lib\libmysql.lib" mysql.pro
              and get the same "Cannot find file: mysql.pro." mistake

              J 1 Reply Last reply 31 Jan 2018, 05:24
              0
              • M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 30 Jan 2018, 23:36 last edited by
                #8

                Hi
                And the mysql.pro file are in
                C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql ?

                C 1 Reply Last reply 31 Jan 2018, 19:11
                1
                • C CrowSun
                  30 Jan 2018, 23:22

                  @jsulm I already have mysql connector. It was installed into Program Files folder by default. Actually installer doesnt even offers me choice of path. But, I tried that one:
                  C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql>qmake "INCLUDEPATH+=C:\Program Files\MySQL\MySQL Connector C 6.1\include" "LIBS+=C:\Program Files\MySQL\MySQL Connector C 6.1\lib\libmysql.lib" mysql.pro
                  and get the same "Cannot find file: mysql.pro." mistake

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 31 Jan 2018, 05:24 last edited by
                  #9

                  @CrowSun Well, it doesn't make sense to call qmake as long as you don't have mysql.pro file.
                  How did you install Qt source code?

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

                  1 Reply Last reply
                  0
                  • M mrjj
                    30 Jan 2018, 23:36

                    Hi
                    And the mysql.pro file are in
                    C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql ?

                    C Offline
                    C Offline
                    CrowSun
                    wrote on 31 Jan 2018, 19:11 last edited by
                    #10

                    @mrjj I have only 3 files in that folder and it is:
                    qsql_mysql_p.h
                    qsql_mysql.pri
                    qsql_mysql.cpp

                    @jsulm i have downloaded file "qt-unified-windows-x86-3.0.2-online" and then just went through installation. I chose almost all components and Source part too.

                    Hope you can help me...
                    Big thank to all of you for replyings and not ignoring my problem!

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 31 Jan 2018, 20:55 last edited by
                      #11

                      Hi,

                      As an alternative, you can download the 5.7.1 source for Windows from here and check with that one.

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

                      C S 2 Replies Last reply 1 Feb 2018, 17:17
                      0
                      • S SGaist
                        31 Jan 2018, 20:55

                        Hi,

                        As an alternative, you can download the 5.7.1 source for Windows from here and check with that one.

                        C Offline
                        C Offline
                        CrowSun
                        wrote on 1 Feb 2018, 17:17 last edited by
                        #12

                        @SGaist Okay, so I replaced components from my folder C:\Qt\5.7\Src with the components from that zip file and than I tried 2 commands below with such results:

                        "C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql>qmake C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql>qmake "INCLUDEPATH+=C:\MySQL-insalldir\MySQL Server 5.7\include" "LIBS+=C:\MySQL-insalldir\MySQL Server 5.7\lib\libmysql.lib" mysql.pro
                        Cannot read C:/Qt/5.7/Src/qtbase/src/sql/drivers/mysql: ???????? ? ???????.
                        Error processing project file: C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql
                        Cannot find file: mysql.pro."

                        and this

                        "C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql>qmake "INCLUDEPATH+=C:\Program Files\MySQL\MySQL Connector C 6.1\include" "LIBS+=C:\Program Files\MySQL\MySQL Connector C 6.1\lib\libmysql.lib" mysql.pro
                        Cannot find file: mysql.pro."

                        :(

                        M 1 Reply Last reply 1 Feb 2018, 17:25
                        0
                        • C CrowSun
                          1 Feb 2018, 17:17

                          @SGaist Okay, so I replaced components from my folder C:\Qt\5.7\Src with the components from that zip file and than I tried 2 commands below with such results:

                          "C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql>qmake C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql>qmake "INCLUDEPATH+=C:\MySQL-insalldir\MySQL Server 5.7\include" "LIBS+=C:\MySQL-insalldir\MySQL Server 5.7\lib\libmysql.lib" mysql.pro
                          Cannot read C:/Qt/5.7/Src/qtbase/src/sql/drivers/mysql: ???????? ? ???????.
                          Error processing project file: C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql
                          Cannot find file: mysql.pro."

                          and this

                          "C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql>qmake "INCLUDEPATH+=C:\Program Files\MySQL\MySQL Connector C 6.1\include" "LIBS+=C:\Program Files\MySQL\MySQL Connector C 6.1\lib\libmysql.lib" mysql.pro
                          Cannot find file: mysql.pro."

                          :(

                          M Offline
                          M Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on 1 Feb 2018, 17:25 last edited by
                          #13

                          @CrowSun
                          and
                          cd C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql
                          type mysql.pro
                          lists the file ?

                          C 1 Reply Last reply 1 Feb 2018, 21:35
                          1
                          • S Offline
                            S Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on 1 Feb 2018, 20:30 last edited by
                            #14

                            Just in case, I've checked the content of the zip file and the /qtbase/src/plugins/sqldrivers/mysql/ folder contains mysql.pro.

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

                            C 1 Reply Last reply 1 Feb 2018, 21:10
                            0
                            • S SGaist
                              1 Feb 2018, 20:30

                              Just in case, I've checked the content of the zip file and the /qtbase/src/plugins/sqldrivers/mysql/ folder contains mysql.pro.

                              C Offline
                              C Offline
                              CrowSun
                              wrote on 1 Feb 2018, 21:10 last edited by
                              #15

                              @SGaist I actually find my super silly mistake. When I type command from C:\Qt\5.7\Src\qtbase\src\plugins\sqldrivers\mysql> command began to executing. BUT... then I get another error.
                              So the picture looks like that:

                              "C:\Qt\5.7\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\Program Files\MySQL\MySQL Connector C 6.1\include" "LIBS+=C:\Program Files\MySQL\MySQL Connector C 6.1\lib\libmysql.lib" mysql.pro
                              Info: creating stash file C:\Qt\5.7\Src\qtbase.qmake.stash"

                              than I entered command:
                              "C:\Qt\5.7\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make"

                              and get that error:

                              "mingw32-make -f Makefile.Release all
                              mingw32-make[1]: Entering directory 'C:/Qt/5.7/Src/qtbase/src/plugins/sqldrivers/mysql'
                              C:\Qt\5.7\mingw53_32\bin\moc.exe -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -D__GNUC__ -DWIN32 -IC:/Qt/5.7/Src/qtbase/mkspecs/win32-g++ -IC:/Qt/5.7/Src/qtbase/src/plugins/sqldrivers/mysql -IC:/Program -IC:/Qt/5.7/Src/qtbase/src/plugins/sqldrivers/mysql/Files/MySQL/MySQL -IC:/Qt/5.7/Src/qtbase/src/plugins/sqldrivers/mysql/Connector -IC:/Qt/5.7/Src/qtbase/src/plugins/sqldrivers/mysql/C -IC:/Qt/5.7/Src/qtbase/src/plugins/sqldrivers/mysql/6.1/include -IC:/Qt/5.7/mingw53_32/include/QtSql/5.7.1 -IC:/Qt/5.7/mingw53_32/include/QtSql/5.7.1/QtSql -IC:/Qt/5.7/mingw53_32/include/QtCore/5.7.1 -IC:/Qt/5.7/mingw53_32/include/QtCore/5.7.1/QtCore -IC:/Qt/5.7/mingw53_32/include -IC:/Qt/5.7/mingw53_32/include/QtSql -IC:/Qt/5.7/mingw53_32/include/QtCore -IC:/Qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include -IC:/Qt/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include-fixed -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++ -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32 -IC:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward main.cpp -o .moc\release\main.moc
                              g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++1z -fno-exceptions -frtti -Wall -Wextra -Wvla -Wdate-time -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -IC:\Program -IFiles\MySQL\MySQL -IConnector -IC -I6.1\include -IC:\Qt\5.7\mingw53_32\include\QtSql\5.7.1 -IC:\Qt\5.7\mingw53_32\include\QtSql\5.7.1\QtSql -IC:\Qt\5.7\mingw53_32\include\QtCore\5.7.1 -IC:\Qt\5.7\mingw53_32\include\QtCore\5.7.1\QtCore -IC:\Qt\5.7\mingw53_32\include -IC:\Qt\5.7\mingw53_32\include\QtSql -IC:\Qt\5.7\mingw53_32\include\QtCore -I.moc\release -IC:/utils/my_sql/my_sql/include -IC:/utils/postgresql/pgsql/include -IC:/openssl/include -I........\mkspecs\win32-g++ -o .obj\release\main.o main.cpp
                              In file included from main.cpp:42:0:
                              ../../../sql/drivers/mysql/qsql_mysql_p.h:60:19: fatal error: mysql.h: No such file or directory
                              compilation terminated.
                              Makefile.Release:322: recipe for target '.obj/release/main.o' failed
                              mingw32-make[1]: *** [.obj/release/main.o] Error 1
                              mingw32-make[1]: Leaving directory 'C:/Qt/5.7/Src/qtbase/src/plugins/sqldrivers/mysql'
                              Makefile:38: recipe for target 'release-all' failed
                              mingw32-make: *** [release-all] Error 2"

                              I already searched info about that mistake and someone says that this is a qt bug. Is it true?

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on 1 Feb 2018, 21:34 last edited by
                                #16

                                You'll likely have to escape the spaces in the path. Or use the good old 8.3 notation. By the way, use forward slashes for your path. Qt will handle conversion for your properly.

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

                                C 2 Replies Last reply 1 Feb 2018, 21:51
                                1
                                • M mrjj
                                  1 Feb 2018, 17:25

                                  @CrowSun
                                  and
                                  cd C:\Qt\5.7\Src\qtbase\src\sql\drivers\mysql
                                  type mysql.pro
                                  lists the file ?

                                  C Offline
                                  C Offline
                                  CrowSun
                                  wrote on 1 Feb 2018, 21:35 last edited by
                                  #17

                                  @mrjj I found mysql.pro in C:\Qt\5.7\Src\qtbase\src\plugins\sqldrivers\mysql and now I'm stacked with a new problem, which I described higher in my previous message.

                                  1 Reply Last reply
                                  0
                                  • S SGaist
                                    1 Feb 2018, 21:34

                                    You'll likely have to escape the spaces in the path. Or use the good old 8.3 notation. By the way, use forward slashes for your path. Qt will handle conversion for your properly.

                                    C Offline
                                    C Offline
                                    CrowSun
                                    wrote on 1 Feb 2018, 21:51 last edited by
                                    #18

                                    @SGaist There isso much spaces in MySql folders by default. Idk how to avoid them properly.
                                    Anyway, i tries with forward slashes:
                                    "C:\Qt\5.7\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:/Program Files/MySQL/MySQL Connector C 6.1/include" "LIBS+=C:/Program Files/MySQL/MySQL Connector C 6.1/lib/libmysql.lib" mysql.pro"

                                    and get the same error...I made something wrong again?

                                    p.s. sorry, but what is that 8.3 notation? never heard before (shame on me)

                                    1 Reply Last reply
                                    0
                                    • S SGaist
                                      1 Feb 2018, 21:34

                                      You'll likely have to escape the spaces in the path. Or use the good old 8.3 notation. By the way, use forward slashes for your path. Qt will handle conversion for your properly.

                                      C Offline
                                      C Offline
                                      CrowSun
                                      wrote on 1 Feb 2018, 22:11 last edited by
                                      #19

                                      @SGaist will it became a solution for my problem if I'll take all needed folders(include) and libs(libmysql.lib) to another created folder without spaces and use this new pathes in my command? Will it work or it will cause just a new problems?

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on 1 Feb 2018, 22:15 last edited by
                                        #20

                                        https://en.wikipedia.org/wiki/8.3_filename

                                        It should be good to build the plugin.

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

                                        C 1 Reply Last reply 1 Feb 2018, 22:37
                                        0
                                        • S SGaist
                                          1 Feb 2018, 22:15

                                          https://en.wikipedia.org/wiki/8.3_filename

                                          It should be good to build the plugin.

                                          C Offline
                                          C Offline
                                          CrowSun
                                          wrote on 1 Feb 2018, 22:37 last edited by
                                          #21

                                          @SGaist so that solution is valid? to replace files in folder.
                                          Or I should avoid it and try an 8.3 notation?

                                          1 Reply Last reply
                                          0

                                          11/34

                                          31 Jan 2018, 20:55

                                          topic:navigator.unread, 23
                                          • Login

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