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. [SOLVED]Trying to build mysql driver in Qt 5.1.0 and MySQL 5.6
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Trying to build mysql driver in Qt 5.1.0 and MySQL 5.6

Scheduled Pinned Locked Moved Installation and Deployment
38 Posts 9 Posters 35.1k Views 3 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.
  • M Offline
    M Offline
    morker
    wrote on last edited by
    #20

    Thanks for your post's!

    I got an issue if I want to build my driver. I'm using qt 5.3 and mysql 5.6 (mysql-5.6.20-win32).

    I added mysql.pro to qt creator and add the following two lines to the .pro file:

    @
    LIBS += C:/mysql/mysql-5.6.20-win32lib/libmysql.lib
    INCLUDEPATH += C:/mysql/mysql-5.6.20-win32/include
    @

    I got the following errors if i want to compile the mysql project:

    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'fd'

    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht untersttzt.

    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'fd'

    C:\mysql\mysql-5.6.20-win32\include\mysql_com.h:320: error: C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht untersttzt.

    C:\work\build\qt5\qtbase\src\sql\drivers\mysql\qsql_mysql.cpp:44: error: C1083: Datei (Include) kann nicht ge”ffnet werden: "QtSql/private/qsqldriver_p.h": No such file or directory

    Many thanks for your help!

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

      Hi and welcome to devnet,

      Did you first build Qt 5 yourself ?

      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
      • M Offline
        M Offline
        morker
        wrote on last edited by
        #22

        Hi SGaist,

        yes I built qt5 by my self. I also tried to build the drivers with the following commands (see http://qt-project.org/doc/qt-4.8/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows):

        cd C:\work\build\qt5\qtbase\src\plugins\sqldrivers\mysql

        qmake "INCLUDEPATH+=C:\mysql\mysql-5.6.20-win32\include" "LIBS+=C:\mysql\mysql-5.6.20-win32\lib\libmysql.lib" mysql.pro

        mingw32-make

        If I do the "mingw32-make" command I got the following errors:

        C:\work\build\qt5\qtbase\src\plugins\sqldrivers\mysql>mingw32-make
        mingw32-make -f Makefile.Release all
        mingw32-make[1]: Entering directory 'C:/work/build/qt5/qtbase/src/plugins/sqldri
        vers/mysql'
        Makefile.Release:65: *** missing separator. Stop.
        mingw32-make[1]: Leaving directory 'C:/work/build/qt5/qtbase/src/plugins/sqldriv
        ers/mysql'
        mingw32-make[1]: Leaving directory 'C:/work/build/qt5/qtbase/src/plugins/sqldriv
        ers/mysql'
        Makefile:40: recipe for target 'release-all' failed
        mingw32-make: *** [release-all] Error 2

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

          You're on windows either escape the backslashes or since you are using Qt use the unix notation i.e. forward slashes

          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
          • M Offline
            M Offline
            morker
            wrote on last edited by
            #24

            I'm working on a windows machine. You can see in my post that I'm setting the INCLUDEPATH and the LIBS with \

            What means this error exactly:

            Makefile.Release:65: *** missing separator. Stop.

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

              I know you are, and I already wrote the options you have:

              • escape the \ so in practice use \
              • Since you are using Qt use /

              Second option is cleaner.

              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
              • M Offline
                M Offline
                morker
                wrote on last edited by
                #26

                Sorry for that stupid questions. I'm using the QT 5.4.0 64-bit for Desktop (MSVC 2013) command line.

                I got the same errors if I'm setting the paths like:

                qmake "INCLUDEPATH+=C:\mysql\mysql-5.6.20-win32\include" "LIBS+=C:\mysql\mysql-5.6.20-win32\lib\libmysql.lib" mysql.pro

                or:

                qmake "INCLUDEPATH+=C:/mysql/mysql-5.6.20-win32/include" "LIBS+=C:/mysql/mysql-5.6.20-win32/lib/libmysql.lib" mysql.pro

                or does it mean that I have to set the slashes in the Makefile.Release instead of \ to /

                Many thanks.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  morker
                  wrote on last edited by
                  #27

                  Ok, i was googling the problem. I get the error in the Makefile.Release in line 65:

                  @{......\sql\drivers\mysql}.cpp{.obj\release}.obj::
                  $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo.obj\release\ @<<
                  $<
                  <<@

                  I get the error in line "<<"

                  I add before "<<" a tab, so "\T<<". After I fired the mingw32-make command I still got the same problem. It seems to me that the Make.Release and Make.Debug files are generated each time if I do the mingw32-make command.

                  Where can I set this behavior?

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

                    First thing to do is to delete that folder content and restart

                    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
                    • D Offline
                      D Offline
                      Dark2011
                      wrote on last edited by
                      #29

                      I have the same problem "Makefile.Release:65: *** missing separator"
                      and i looked in Makefile.Release and didn't find missing separator)
                      There were my steps:

                      1. create folder [tempMySQL] with include and lib folders from mysqlserver folder
                        It's look like this
                        c:\qt\qt5.3.1\tempMySQL

                      2. open mingw console and go to "C:\Qt\Qt5.3.1\5.3\Src\qtbase\src\plugins\sqldrivers\mysql"

                      3. qmake "INCLUDEPATH+=C:\Qt\Qt5.3.1\tempMySQL\include" "LIBS+=C:\Qt\Qt5.3.1\tempMySQL\libmysql.lib" mysql.pro

                      4. mingw32-make

                      I didn't build Qt5.3.1 by myself, i just download
                      Qt 5.3.1 for Windows 32-bit (MinGW 4.8.2, OpenGL, 737 MB) (Info) from here

                      And when i worked with Qt 4.8.4 with VS2010 i didn't have a problem.
                      I got all those steps then i describe above and it build and worked wihout any problem

                      And of course i add mingw to PATH

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        Dark2011
                        wrote on last edited by
                        #30

                        remark: when i build this driver for Qt4.8.4 and VS2010 i used nmake, of course)

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

                          Is libmysql.lib the static MySQL client lib ?

                          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
                          • D Offline
                            D Offline
                            Dark2011
                            wrote on last edited by
                            #32

                            libmysql.lib it's static library. I got it from .../MySQL/MySQL Server 5.6/lib
                            maybe i don't understand your question?

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

                              Yes you understood it well. The thing is, on windows, static libraries and import libraries have the same extension but don't work the same. And furthermore, you can't mix mingw and MSVC libraries like that.

                              Look at this "wiki entry":http://www.qtcentre.org/wiki/index.php?title=Building_the_QMYSQL_plugin_on_Windows_using_MinGW

                              For the steps to use MinGW

                              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
                              • D Offline
                                D Offline
                                Dark2011
                                wrote on last edited by
                                #34

                                The same result(((...

                                BUT:
                                I found that i have MySQL drivers with official build of QT5.3.2))) I have no idea why i didn't see it in first time and spent much time trying to build this drivers)).
                                And firstly it didn't work too. Finally i put libmysql.dll into ...\Qt5.3.2\5.3\mingw482_32\bin and it works.!

                                I think that problem with my own building of these drivers is that i have VS10, VS12, and MinGW compiler on one OS.... When i'll have free time, maybe in this everning i'll try to build it by mingw on virt. mach with Win7 without another compilers

                                Remark: i don't have an idea why - but reimp util from MINGW Utils works only in old version (0.3)

                                1 Reply Last reply
                                0
                                • K Offline
                                  K Offline
                                  Kaluss
                                  wrote on last edited by
                                  #35
                                  This post is deleted!
                                  1 Reply Last reply
                                  0
                                  • K Offline
                                    K Offline
                                    Kaluss
                                    wrote on last edited by
                                    #36

                                    Hello All,
                                    I do as following:
                                    C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\mySQL\include" "LIBS+=C:\mySQL\lib\libmysql.lib" mysql.pro

                                    C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make

                                    And go outpu like that:
                                    C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\src\plugins\sqldrivers\mysql>mingw32-make
                                    mingw32-make -f Makefile.Release all
                                    mingw32-make[1]: Entering directory 'C:/Qt/Qt5.1.1/5.1.1/Src/qtbase/src/plugins/sqldrivers/mysql'
                                    C:\Qt\Qt5.1.1\5.1.1\mingw48_32\bin\moc.exe -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPT
                                    release_shared" -I"........\mkspecs\win32-g++" main.cpp -o .moc\release_shared\main.moc
                                    g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAS
                                    \QtCore\5.1.1\QtCore" -I".moc\release_shared" -I"........\mkspecs\win32-g++" -o .obj\release_shared\main.o mai
                                    C:\Qt\Qt5.1.1\5.1.1\mingw48_32\bin\moc.exe -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPT
                                    release_shared" -I"........\mkspecs\win32-g++" ......\sql\drivers\mysql\qsql_mysql.cpp -o .moc\release_share
                                    g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAS
                                    \QtCore\5.1.1\QtCore" -I".moc\release_shared" -I"........\mkspecs\win32-g++" -o .obj\release_shared\qsql_mysql
                                    C:\Qt\Qt5.1.1\5.1.1\mingw48_32\bin\moc.exe -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPT
                                    release_shared" -I"........\mkspecs\win32-g++" ......\sql\drivers\mysql\qsql_mysql_p.h -o .moc\release_share
                                    g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -Wall -Wextra -DUNICODE -DQT_NO_CAS
                                    \QtCore\5.1.1\QtCore" -I".moc\release_shared" -I"........\mkspecs\win32-g++" -o .obj\release_shared\moc_qsql_m
                                    g++ -Wl,-s -shared -Wl,--out-implib,C:\Qt\Qt5.1.1\5.1.1\Src\qtbase\plugins\sqldrivers\libqsqlmysql.a -o ......
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x17c): undefined reference to mysql_num_rows@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1a7): undefined reference to mysql_stmt_num_rows@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x23c): undefined reference to mysql_num_rows@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x259): undefined reference to mysql_stmt_num_rows@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x29e): undefined reference to mysql_stmt_insert_id@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2da): undefined reference to mysql_insert_id@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x374): undefined reference to mysql_thread_end@0' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x37f): undefined reference to mysql_close@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x7e8): undefined reference to mysql_character_set_name@4 .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x9c9): undefined reference to mysql_errno@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x9e0): undefined reference to mysql_field_seek@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa04): undefined reference to mysql_field_seek@8'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa0f): undefined reference to mysql_fetch_field@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa4f): undefined reference to mysql_fetch_field@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa81): undefined reference to mysql_error@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xa90): undefined reference to mysql_errno@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xc17): undefined reference to mysql_errno@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xc51): undefined reference to mysql_stmt_error@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xc5e): undefined reference to mysql_stmt_errno@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xdda): undefined reference to mysql_query@8'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0xf1a): undefined reference to mysql_query@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x105a): undefined reference to mysql_query@8'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1190): undefined reference to mysql_fetch_row@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x11d7): undefined reference to mysql_stmt_fetch@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1372): undefined reference to mysql_list_fields@12' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x13cd): undefined reference to mysql_fetch_field@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x13dc): undefined reference to mysql_free_result@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1ccc): undefined reference to mysql_init@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x1e1e): undefined reference to mysql_real_connect@32' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2031): undefined reference to mysql_close@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x21ff): undefined reference to mysql_real_connect@32' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2271): undefined reference to mysql_set_character_set@8
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2284): undefined reference to mysql_get_client_version@ .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x229d): undefined reference to mysql_thread_init@0'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x240d): undefined reference to mysql_select_db@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x253f): undefined reference to mysql_close@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x25eb): undefined reference to mysql_get_server_version@ .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x261b): undefined reference to mysql_options@12'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x26ce): undefined reference to mysql_stmt_data_seek@12' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x26df): undefined reference to mysql_stmt_fetch@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2746): undefined reference to mysql_data_seek@12' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x2757): undefined reference to mysql_fetch_row@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x29ad): undefined reference to mysql_fetch_lengths@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x38d4): undefined reference to mysql_get_server_version@
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3d73): undefined reference to mysql_list_tables@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3dbd): undefined reference to mysql_data_seek@12'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3dc8): undefined reference to mysql_fetch_row@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x3fd0): undefined reference to mysql_free_result@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4172): undefined reference to mysql_next_result@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x419a): undefined reference to mysql_store_result@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x41b4): undefined reference to mysql_field_count@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x420b): undefined reference to mysql_affected_rows@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x42a2): undefined reference to mysql_fetch_field_direct@ .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x441c): undefined reference to mysql_free_result@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x46bb): undefined reference to mysql_num_fields@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x47b2): undefined reference to mysql_fetch_field@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x48a4): undefined reference to mysql_stmt_result_metadat .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x48d7): undefined reference to mysql_free_result@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x48f8): undefined reference to mysql_next_result@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4915): undefined reference to mysql_stmt_close@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x493b): undefined reference to mysql_free_result@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x49f4): undefined reference to mysql_store_result@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4d52): undefined reference to mysql_real_query@12' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4e43): undefined reference to mysql_store_result@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4e68): undefined reference to mysql_field_count@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4eaa): undefined reference to mysql_affected_rows@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x4f42): undefined reference to mysql_fetch_field_direct@ .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5010): undefined reference to mysql_field_count@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x50f6): undefined reference to mysql_stmt_prepare@12' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x510f): undefined reference to mysql_stmt_param_count@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5179): undefined reference to mysql_stmt_init@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x533a): undefined reference to mysql_stmt_param_count@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x540c): undefined reference to mysql_stmt_reset@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x560d): undefined reference to mysql_stmt_param_count@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5626): undefined reference to mysql_stmt_execute@4' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5785): undefined reference to mysql_stmt_affected_rows@
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x57b5): undefined reference to mysql_stmt_bind_result@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x57d8): undefined reference to mysql_stmt_store_result@4
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5806): undefined reference to mysql_stmt_bind_result@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x584a): undefined reference to mysql_stmt_param_count@4'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x5bca): undefined reference to mysql_stmt_bind_param@8' .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x609d): undefined reference to mysql_stmt_attr_set@12'
                                    .obj/release_shared/qsql_mysql.o:qsql_mysql.cpp:(.text+0x6172): undefined reference to `mysql_real_escape_string@
                                    c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: .ob
                                    collect2.exe: error: ld returned 1 exit status
                                    Makefile.Release:80: recipe for target '........\plugins\sqldrivers\qsqlmysql.dll' failed
                                    mingw32-make[1]: *** [........\plugins\sqldrivers\qsqlmysql.dll] Error 1
                                    mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.1.1/5.1.1/Src/qtbase/src/plugins/sqldrivers/mysql'
                                    makefile:38: recipe for target 'release-all' failed
                                    mingw32-make: *** [release-all] Error 2

                                    Pleas help me.
                                    What Im doing wrong?

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

                                      Hi,

                                      Looks like your not linking to the MySQL library.

                                      LIBS+=-LC:/mySQL/lib -lmysql

                                      should be the correct syntax

                                      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
                                      • P Offline
                                        P Offline
                                        Peter Van Grieken
                                        wrote on last edited by
                                        #38

                                        I know this is a very very old topic, but nonetheless somebody might benefit from this:

                                        I was able to compile the mysql driver like this:

                                        • Using Win10 home 64-bit
                                        • Installed QT 5.15.0 64-bit (mingw)
                                        • Installed mysql server 8.0.14 (located in C:\Program Files\MySQL\MySQL Server 8.0) and Connector C++ 8.0.15 (located in C:\Program Files\MySQL\Connector C++ 8.0. B. Both are 64-bit.
                                        • Started QT and opened C:\Qt\5.15.0\Src\qtbase\src\plugins\plugins.pro

                                        Modify mysql.pro like this (mind the forward slashes this was the last culprit why it didn't work here!):

                                        TARGET = qsqlmysql
                                        
                                        INCLUDEPATH +='C://Program Files//MySQL//MySQL Server 8.0//include'
                                        DEPENDPATH += 'C://Program Files//MySQL//MySQL Server 8.0//include'
                                        LIBS += 'C://Program Files//MySQL//MySQL Server 8.0//lib//libmysql.lib'
                                        
                                        HEADERS += $$PWD/qsql_mysql_p.h
                                        SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
                                        
                                        #QMAKE_USE += mysql
                                        
                                        OTHER_FILES += mysql.json
                                        
                                        PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
                                        include(C:\Qt\5.15.0\Src\qtbase\src\plugins\sqldrivers\qsqldriverbase.pri)
                                        
                                        • In QT Creator rightclick on the folder "mysql" and select "Build mysql"
                                        • Make sure to do above in both release and debug

                                        I found the files I needed in:
                                        C:\Qt\5.15.0\Src\qtbase\src\plugins\build-sqldrivers-Desktop_Qt_5_15_0_MinGW_64_bit-Debug\plugins\sqldrivers
                                        C:\Qt\5.15.0\Src\qtbase\src\plugins\build-sqldrivers-Desktop_Qt_5_15_0_MinGW_64_bit-Release\plugins\sqldrivers

                                        1 Reply Last reply
                                        1

                                        • Login

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