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. Cannot mix incompatible Qt library
Forum Updated to NodeBB v4.3 + New Features

Cannot mix incompatible Qt library

Scheduled Pinned Locked Moved Solved Installation and Deployment
32 Posts 4 Posters 13.7k 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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #6

    Again: take a look in your PATH env var.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    T 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      Again: take a look in your PATH env var.

      T Offline
      T Offline
      Tamfub
      wrote on last edited by Tamfub
      #7

      @Christian-Ehrlicher I've checked my env variables, but no 5.12.3. There was a 5.12.3 before, but I replaced it.
      d5050ddf-176b-48a4-874e-24da9e4e1bb0-image.png

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Tamfub
        wrote on last edited by
        #8

        Do I need to restart my PC after changing my env variables?

        JonBJ 1 Reply Last reply
        0
        • T Tamfub

          Do I need to restart my PC after changing my env variables?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #9

          @Tamfub
          Depends where you set them, and what you run from where. Wouldn't it be quicker to reboot for sure than to ask here? :)

          1 Reply Last reply
          0
          • T Tamfub

            Hi. Sorry, I know this question has been asked so many times, but I still can't figure out how to solve my problem.

            I have two version installed:

            • 5.12.3 (w/ mingw73_64)

            • 5.15.1 (w/ mingw81_64)

            I started working on a project months ago. I built it w/ the first configuration, downloaded a bunch of MYSQL plugin/dll to make it work, and it worked fine.
            dc9948de-cf2f-4462-990c-b895dca9e947-image.png

            Now, I would like to move to the second configuration. To do that:

            • I copied the files above in C\Qt\5.15.1\mingw81_64\plugins\sqldrivers

            • I changed kit

            • I edited my myProject.pro to:

            win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/lib/ -llibmysql
            else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/lib/ -llibmysqld
            
            INCLUDEPATH += $$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/include
            DEPENDPATH += $$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/include
            

            After building and running, the program abruptly crashed during a DB-related operation, with a long message in the output. It follows an excerpt:

            loaded library "C:/Qt/5.15.1/mingw81_64/plugins/sqldrivers/qsqlmysql.dll"
            Cannot mix incompatible Qt library (5.12.3) with this library (5.15.1)
            16:45:25: The program has unexpectedly finished.
            

            Could you help me with this?

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #10

            @Tamfub said in Cannot mix incompatible Qt library:

            I built it w/ the first configuration, downloaded a bunch of MYSQL plugin/dll to make it work, and it worked fine.

            ...

            Now, I would like to move to the second configuration. To do that:

            • I copied the files above in C\Qt\5.15.1\mingw81_64\plugins\sqldrivers

            Those DLLs were built with Qt 5.12.3, so you cannot copy them into your Qt 5.15 folder.

            You must rebuild those DLLs using Qt 5.15.

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            1
            • T Offline
              T Offline
              Tamfub
              wrote on last edited by Tamfub
              #11

              @JonB I could not restart my PC at that moment. Now that I've done it, I've got the same problem.

              @JKSH Hi! How do I rebuild the DLLs? Should I remove them from my Qt 5.15 folder and add those in the 5.12.3 folder via the "Add libraries..." tool?

              JKSHJ 1 Reply Last reply
              0
              • T Tamfub

                @JonB I could not restart my PC at that moment. Now that I've done it, I've got the same problem.

                @JKSH Hi! How do I rebuild the DLLs? Should I remove them from my Qt 5.15 folder and add those in the 5.12.3 folder via the "Add libraries..." tool?

                JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #12

                @Tamfub said in Cannot mix incompatible Qt library:

                How do I rebuild the DLLs?

                See https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows

                Should I remove them from my Qt 5.15 folder

                Yes, remove everything that you copied. They are incompatible with Qt 5.15.1, as mentioned in your original error message.

                add those in the 5.12.3 folder via the "Add libraries..." tool?

                No, you cannot add DLLs from Qt 5.12.3 into your Qt 5.15.1 project.

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                T 1 Reply Last reply
                1
                • JKSHJ JKSH

                  @Tamfub said in Cannot mix incompatible Qt library:

                  How do I rebuild the DLLs?

                  See https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows

                  Should I remove them from my Qt 5.15 folder

                  Yes, remove everything that you copied. They are incompatible with Qt 5.15.1, as mentioned in your original error message.

                  add those in the 5.12.3 folder via the "Add libraries..." tool?

                  No, you cannot add DLLs from Qt 5.12.3 into your Qt 5.15.1 project.

                  T Offline
                  T Offline
                  Tamfub
                  wrote on last edited by
                  #13

                  @JKSH
                  I've read what's written here. This is my MySql conf folder:
                  27d453bb-f335-46c1-ba47-c27cc0a2c84d-image.png
                  The files

                  • ./include/mysql.h
                  • ./bin/libmysql.dll
                  • /bin/libmysql.lib

                  are present.

                  As indicated in the link, I opened a terminal in Windows, in C:\Qt\5.15.1\Src\qtbase and typed
                  qmake -- MYSQL_INCDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\include" MYSQL_LIBDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib"

                  But I got this:
                  0d2717b3-8dd4-4033-bb23-42fa49381aa9-image.png

                  Instead, this worked:
                  9f0342e3-864e-4e41-8f08-777c77418973-image.png

                  C:/Qt/5.15.1/mingw81_64/lib is the value of my PATH env variable, and Qt Creator is running in the background. What am I missing/getting wrong?

                  JKSHJ 1 Reply Last reply
                  1
                  • T Tamfub

                    @JKSH
                    I've read what's written here. This is my MySql conf folder:
                    27d453bb-f335-46c1-ba47-c27cc0a2c84d-image.png
                    The files

                    • ./include/mysql.h
                    • ./bin/libmysql.dll
                    • /bin/libmysql.lib

                    are present.

                    As indicated in the link, I opened a terminal in Windows, in C:\Qt\5.15.1\Src\qtbase and typed
                    qmake -- MYSQL_INCDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\include" MYSQL_LIBDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib"

                    But I got this:
                    0d2717b3-8dd4-4033-bb23-42fa49381aa9-image.png

                    Instead, this worked:
                    9f0342e3-864e-4e41-8f08-777c77418973-image.png

                    C:/Qt/5.15.1/mingw81_64/lib is the value of my PATH env variable, and Qt Creator is running in the background. What am I missing/getting wrong?

                    JKSHJ Offline
                    JKSHJ Offline
                    JKSH
                    Moderators
                    wrote on last edited by JKSH
                    #14

                    @Tamfub said in Cannot mix incompatible Qt library:

                    I've read what's written here.

                    ...

                    The files

                    • ./include/mysql.h
                    • ./bin/libmysql.dll
                    • /bin/libmysql.lib

                    are present.

                    ...

                    As indicated in the link, I opened a terminal in Windows, in C:\Qt\5.15.1\Src\qtbase and typed

                    qmake -- MYSQL_INCDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\include" MYSQL_LIBDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib"

                    These are all very good. You are on the right track.

                    EDIT: You are in the wrong folder. You should be in qtbase\src\plugins\sqldrivers\, not in qtbase\.

                    What am I missing/getting wrong?

                    Have a closer look at the error message. It says, "ERROR: Cannot run compiler 'g++'.... Maybe you forgot to setup the environment?"

                    That means your compiler, g++.exe, is not found in your terminal's environment.

                    Instead, this worked:
                    9f0342e3-864e-4e41-8f08-777c77418973-image.png

                    C:/Qt/5.15.1/mingw81_64/lib is the value of my PATH env variable,

                    This shows that you have successfully added the Qt 5.15.1 DLLs and executables (like qmake.exe) to your environment.

                    You must also add your compiler to your environment. When you do that, you should also get a valid output when you type g++ --version into your terminal.

                    You can install the MinGW x64 compiler from the Qt online installer. The default folder is C:\Qt\Tools\mingw810_64\bin.

                    Qt Creator is running in the background.

                    Qt Creator has no effect on your terminal's environment. You can close Qt Creator.

                    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                    T 1 Reply Last reply
                    1
                    • JKSHJ JKSH

                      @Tamfub said in Cannot mix incompatible Qt library:

                      I've read what's written here.

                      ...

                      The files

                      • ./include/mysql.h
                      • ./bin/libmysql.dll
                      • /bin/libmysql.lib

                      are present.

                      ...

                      As indicated in the link, I opened a terminal in Windows, in C:\Qt\5.15.1\Src\qtbase and typed

                      qmake -- MYSQL_INCDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\include" MYSQL_LIBDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib"

                      These are all very good. You are on the right track.

                      EDIT: You are in the wrong folder. You should be in qtbase\src\plugins\sqldrivers\, not in qtbase\.

                      What am I missing/getting wrong?

                      Have a closer look at the error message. It says, "ERROR: Cannot run compiler 'g++'.... Maybe you forgot to setup the environment?"

                      That means your compiler, g++.exe, is not found in your terminal's environment.

                      Instead, this worked:
                      9f0342e3-864e-4e41-8f08-777c77418973-image.png

                      C:/Qt/5.15.1/mingw81_64/lib is the value of my PATH env variable,

                      This shows that you have successfully added the Qt 5.15.1 DLLs and executables (like qmake.exe) to your environment.

                      You must also add your compiler to your environment. When you do that, you should also get a valid output when you type g++ --version into your terminal.

                      You can install the MinGW x64 compiler from the Qt online installer. The default folder is C:\Qt\Tools\mingw810_64\bin.

                      Qt Creator is running in the background.

                      Qt Creator has no effect on your terminal's environment. You can close Qt Creator.

                      T Offline
                      T Offline
                      Tamfub
                      wrote on last edited by
                      #15

                      @JKSH
                      Hi, I've managed to make my qmake command run
                      568d7381-2012-451d-aa65-24398f737bbd-image.png
                      It asked me which edition I would like to use. After that, I got:
                      a7202ee2-acf7-4e2a-b636-0619e9336644-image.png
                      If I run mingw32-make, will it install Qt from scratch and delete my Qt folder? Instead, if I run nmake sub-mysql, it says that nmake is not recognized. I tried to replace nmake with mingw32-make, but it says
                      005afc67-dd30-4cd0-a5eb-f8770c8c26ce-image.png

                      JKSHJ 1 Reply Last reply
                      0
                      • Christian EhrlicherC Offline
                        Christian EhrlicherC Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #16

                        Please follow the documentation (and start over with a clean source dir):
                        C:\Qt5\5.13.2\Src\qtbase\src\plugins\sqldrivers>qmake -version

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        1 Reply Last reply
                        1
                        • T Tamfub

                          @JKSH
                          Hi, I've managed to make my qmake command run
                          568d7381-2012-451d-aa65-24398f737bbd-image.png
                          It asked me which edition I would like to use. After that, I got:
                          a7202ee2-acf7-4e2a-b636-0619e9336644-image.png
                          If I run mingw32-make, will it install Qt from scratch and delete my Qt folder? Instead, if I run nmake sub-mysql, it says that nmake is not recognized. I tried to replace nmake with mingw32-make, but it says
                          005afc67-dd30-4cd0-a5eb-f8770c8c26ce-image.png

                          JKSHJ Offline
                          JKSHJ Offline
                          JKSH
                          Moderators
                          wrote on last edited by
                          #17

                          @Christian-Ehrlicher is right: You are in the wrong folder. You should be in qtbase\src\plugins\sqldrivers

                          You should also clean out your source folders before trying again. (Delete all files that were generated by qmake)

                          @Tamfub said in Cannot mix incompatible Qt library:

                          Instead, if I run nmake sub-mysql, it says that nmake is not recognized.

                          nmake is for MSVC, not MinGW.

                          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                          T 1 Reply Last reply
                          1
                          • JKSHJ JKSH

                            @Christian-Ehrlicher is right: You are in the wrong folder. You should be in qtbase\src\plugins\sqldrivers

                            You should also clean out your source folders before trying again. (Delete all files that were generated by qmake)

                            @Tamfub said in Cannot mix incompatible Qt library:

                            Instead, if I run nmake sub-mysql, it says that nmake is not recognized.

                            nmake is for MSVC, not MinGW.

                            T Offline
                            T Offline
                            Tamfub
                            wrote on last edited by Tamfub
                            #18

                            @JKSH Ok, got it. Sorry for the silly question, but how do I clean out the source folders? From the terminal with a specific command in a specific folder? From Qt Creator (like this)?
                            b45fc8bc-cff4-49ad-9612-690b97a3eb2a-image.png
                            Also, I moved to qtbase\src\plugins\sqldrivers and re-typed (w/out cleaning) qmake -- MYSQL_INCDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\include" MYSQL_LIBDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib", but the usage for qmake appeared in the output.

                            JKSHJ 1 Reply Last reply
                            0
                            • T Tamfub

                              @JKSH Ok, got it. Sorry for the silly question, but how do I clean out the source folders? From the terminal with a specific command in a specific folder? From Qt Creator (like this)?
                              b45fc8bc-cff4-49ad-9612-690b97a3eb2a-image.png
                              Also, I moved to qtbase\src\plugins\sqldrivers and re-typed (w/out cleaning) qmake -- MYSQL_INCDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\include" MYSQL_LIBDIR="C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib", but the usage for qmake appeared in the output.

                              JKSHJ Offline
                              JKSHJ Offline
                              JKSH
                              Moderators
                              wrote on last edited by
                              #19

                              @Tamfub said in Cannot mix incompatible Qt library:

                              how do I clean out the source folders? From the terminal with a specific command in a specific folder? From Qt Creator (like this)?

                              It depends on how you got your source code.

                              If you extracted it from a Zip file, the easiest thing to do is delete the source folders and extract it again.

                              You can't use Qt Creator for this.

                              the usage for qmake appeared in the output.

                              It probably means you made a mistake while typing. Check again carefully after you clean your source folder.

                              I just noticed something else: It looks like you are using 64-bit Qt and 64-bit MinGW. Therefore, you must also use the 64-bit MySQL C connector. (Your screenshots show that you've installed 32-bit MySQL)

                              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                              T 1 Reply Last reply
                              1
                              • JKSHJ JKSH

                                @Tamfub said in Cannot mix incompatible Qt library:

                                how do I clean out the source folders? From the terminal with a specific command in a specific folder? From Qt Creator (like this)?

                                It depends on how you got your source code.

                                If you extracted it from a Zip file, the easiest thing to do is delete the source folders and extract it again.

                                You can't use Qt Creator for this.

                                the usage for qmake appeared in the output.

                                It probably means you made a mistake while typing. Check again carefully after you clean your source folder.

                                I just noticed something else: It looks like you are using 64-bit Qt and 64-bit MinGW. Therefore, you must also use the 64-bit MySQL C connector. (Your screenshots show that you've installed 32-bit MySQL)

                                T Offline
                                T Offline
                                Tamfub
                                wrote on last edited by Tamfub
                                #20

                                @JKSH I made it work now, I have mistaken qtbase\src\plugins with qtbase\plugins. Back to my project now. My .pro file contains:

                                win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/lib/ -llibmysql
                                else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/lib/ -llibmysqld
                                
                                INCLUDEPATH += $$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/include
                                DEPENDPATH += $$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/include
                                

                                That is:
                                0ba17a74-572f-4250-ab40-1617448fbc26-image.png

                                ab1033f1-659e-41b2-b349-00e73c068ae4-image.png

                                c3786cea-672c-4d01-86a6-ff2a48d7910e-image.png

                                The kit is:
                                e4bbfd49-5e30-4b25-b682-fa2a0c156c3b-image.png

                                When I run my project from Qt Creator, it works! I would like to deploy my app, so I go to [build folder]/release, clean its content (except the executable), open a terminal and type
                                windeployqt.exe .

                                I launch the .exe, but the SQL-related part does not work... This is the output of the windeployqt command:

                                C:\Qt\Projects\tutorial\progettoMalnati\sharedtexteditor\build-progettoMalnati_srv_2-Desktop_Qt_5_15_1_MinGW_64_bit-Release\release\progettoMalnati_srv_2.exe 64 bit, release executable
                                Adding Qt5Svg for qsvgicon.dll
                                Direct dependencies: Qt5Core Qt5Gui Qt5Network Qt5Sql Qt5Widgets
                                All dependencies   : Qt5Core Qt5Gui Qt5Network Qt5Sql Qt5Widgets
                                To be deployed     : Qt5Core Qt5Gui Qt5Network Qt5Sql Qt5Svg Qt5Widgets
                                Updating Qt5Core.dll.
                                Updating Qt5Gui.dll.
                                Updating Qt5Network.dll.
                                Updating Qt5Sql.dll.
                                Updating Qt5Svg.dll.
                                Updating Qt5Widgets.dll.
                                Updating libGLESv2.dll.
                                Updating libEGL.dll.
                                Updating D3Dcompiler_47.dll.
                                Updating opengl32sw.dll.
                                Updating libgcc_s_seh-1.dll.
                                Updating libstdc++-6.dll.
                                Updating libwinpthread-1.dll.
                                Creating directory C:/Qt/Projects/tutorial/progettoMalnati/sharedtexteditor/build-progettoMalnati_srv_2-Desktop_Qt_5_15_1_MinGW_64_bit-Release/release/bearer.
                                Updating qgenericbearer.dll.
                                Creating directory C:/Qt/Projects/tutorial/progettoMalnati/sharedtexteditor/build-progettoMalnati_srv_2-Desktop_Qt_5_15_1_MinGW_64_bit-Release/release/iconengines.
                                Updating qsvgicon.dll.
                                Creating directory C:/Qt/Projects/tutorial/progettoMalnati/sharedtexteditor/build-progettoMalnati_srv_2-Desktop_Qt_5_15_1_MinGW_64_bit-Release/release/imageformats.
                                Updating qgif.dll.
                                Updating qicns.dll.
                                Updating qico.dll.
                                Updating qjpeg.dll.
                                Updating qsvg.dll.
                                Updating qtga.dll.
                                Updating qtiff.dll.
                                Updating qwbmp.dll.
                                Updating qwebp.dll.
                                Creating directory C:/Qt/Projects/tutorial/progettoMalnati/sharedtexteditor/build-progettoMalnati_srv_2-Desktop_Qt_5_15_1_MinGW_64_bit-Release/release/platforms.
                                Updating qwindows.dll.
                                Creating directory C:/Qt/Projects/tutorial/progettoMalnati/sharedtexteditor/build-progettoMalnati_srv_2-Desktop_Qt_5_15_1_MinGW_64_bit-Release/release/sqldrivers.
                                Updating qsqlite.dll.
                                Updating qsqlmysql.dll.
                                Updating qsqlodbc.dll.
                                Creating directory C:/Qt/Projects/tutorial/progettoMalnati/sharedtexteditor/build-progettoMalnati_srv_2-Desktop_Qt_5_15_1_MinGW_64_bit-Release/release/styles.
                                Updating qwindowsvistastyle.dll.
                                Creating C:\Qt\Projects\tutorial\progettoMalnati\sharedtexteditor\build-progettoMalnati_srv_2-Desktop_Qt_5_15_1_MinGW_64_bit-Release\release\translations...
                                Creating qt_ar.qm...
                                Creating qt_bg.qm...
                                Creating qt_ca.qm...
                                Creating qt_cs.qm...
                                Creating qt_da.qm...
                                Creating qt_de.qm...
                                Creating qt_en.qm...
                                Creating qt_es.qm...
                                Creating qt_fi.qm...
                                Creating qt_fr.qm...
                                Creating qt_gd.qm...
                                Creating qt_he.qm...
                                Creating qt_hu.qm...
                                Creating qt_it.qm...
                                Creating qt_ja.qm...
                                Creating qt_ko.qm...
                                Creating qt_lv.qm...
                                Creating qt_pl.qm...
                                Creating qt_ru.qm...
                                Creating qt_sk.qm...
                                Creating qt_tr.qm...
                                Creating qt_uk.qm...
                                Creating qt_zh_TW.qm...
                                
                                1 Reply Last reply
                                0
                                • Christian EhrlicherC Offline
                                  Christian EhrlicherC Offline
                                  Christian Ehrlicher
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #21

                                  @Tamfub said in Cannot mix incompatible Qt library:

                                  Updating qsqlmysql.dll.

                                  As you can see the plugin is copied, you have to make sure that the dependencies are also available (search the forum, use Dependency Walker)

                                  win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/lib/ -llibmysql
                                  else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/lib/ -llibmysqld
                                  
                                  INCLUDEPATH += $$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/include
                                  DEPENDPATH += $$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/include
                                  

                                  What do you think do gain with this? It's not needed at all.

                                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                  Visit the Qt Academy at https://academy.qt.io/catalog

                                  T 1 Reply Last reply
                                  1
                                  • Christian EhrlicherC Christian Ehrlicher

                                    @Tamfub said in Cannot mix incompatible Qt library:

                                    Updating qsqlmysql.dll.

                                    As you can see the plugin is copied, you have to make sure that the dependencies are also available (search the forum, use Dependency Walker)

                                    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/lib/ -llibmysql
                                    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/lib/ -llibmysqld
                                    
                                    INCLUDEPATH += $$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/include
                                    DEPENDPATH += $$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/include
                                    

                                    What do you think do gain with this? It's not needed at all.

                                    T Offline
                                    T Offline
                                    Tamfub
                                    wrote on last edited by Tamfub
                                    #22

                                    @Christian-Ehrlicher said in Cannot mix incompatible Qt library:

                                    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/lib/ -llibmysql
                                    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/lib/ -llibmysqld

                                    INCLUDEPATH += $$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/include
                                    DEPENDPATH += $$PWD/../../../../../5.15.1/mingw81_64/plugins/sqldrivers/mysql-connector-c-6.1.11-winx64/include

                                    What do you think do gain with this? It's not needed at all.
                                    

                                    If I don't include this, I get this while running my program in Qt:

                                    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/5.15.1/mingw81_64/plugins/sqldrivers" ...
                                    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.15.1/mingw81_64/plugins/sqldrivers/qsqlite.dll"
                                    Found metadata in lib C:/Qt/5.15.1/mingw81_64/plugins/sqldrivers/qsqlite.dll, metadata=
                                    {
                                        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                        "MetaData": {
                                            "Keys": [
                                                "QSQLITE"
                                            ]
                                        },
                                        "archreq": 0,
                                        "className": "QSQLiteDriverPlugin",
                                        "debug": false,
                                        "version": 331520
                                    }
                                    
                                    
                                    Got keys from plugin meta data ("QSQLITE")
                                    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.15.1/mingw81_64/plugins/sqldrivers/qsqlmysql.dll"
                                    Found metadata in lib C:/Qt/5.15.1/mingw81_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
                                    {
                                        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                        "MetaData": {
                                            "Keys": [
                                                "QMYSQL3",
                                                "QMYSQL",
                                                "QMARIADB"
                                            ]
                                        },
                                        "archreq": 0,
                                        "className": "QMYSQLDriverPlugin",
                                        "debug": false,
                                        "version": 331520
                                    }
                                    
                                    
                                    Got keys from plugin meta data ("QMYSQL3", "QMYSQL", "QMARIADB")
                                    QFactoryLoader::QFactoryLoader() looking at "C:/Qt/5.15.1/mingw81_64/plugins/sqldrivers/qsqlodbc.dll"
                                    Found metadata in lib C:/Qt/5.15.1/mingw81_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
                                    {
                                        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                        "MetaData": {
                                            "Keys": [
                                                "QODBC3",
                                                "QODBC"
                                            ]
                                        },
                                        "archreq": 0,
                                        "className": "QODBCDriverPlugin",
                                        "debug": false,
                                        "version": 331520
                                    }
                                    
                                    
                                    Got keys from plugin meta data ("QODBC3", "QODBC")
                                    QFactoryLoader::QFactoryLoader() checking directory path "C:/Qt/Projects/tutorial/progettoMalnati/sharedtexteditor/build-progettoMalnati_srv_2-Desktop_Qt_5_15_1_MinGW_64_bit-Release/release/sqldrivers" ...
                                    Cannot load library C:\Qt\5.15.1\mingw81_64\plugins\sqldrivers\qsqlmysql.dll: Impossibile trovare il modulo specificato.
                                    QLibraryPrivate::loadPlugin failed on "C:/Qt/5.15.1/mingw81_64/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\\Qt\\5.15.1\\mingw81_64\\plugins\\sqldrivers\\qsqlmysql.dll: Impossibile trovare il modulo specificato."
                                    QSqlDatabase: QMYSQL driver not loaded
                                    QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QMYSQL3 QODBC QODBC3
                                    Errore nel collegamento al DB
                                    "Driver not loaded Driver not loaded"
                                    

                                    i.e. it cannot load the MYSQL driver. Also, Dependency Walker is taking ages to analyze my .exe. They say it is a normal behaviour, but 5 minutes is too much I guess.

                                    1 Reply Last reply
                                    0
                                    • Christian EhrlicherC Offline
                                      Christian EhrlicherC Offline
                                      Christian Ehrlicher
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #23

                                      @Tamfub said in Cannot mix incompatible Qt library:

                                      If I don't include this, I get this while running my program in Qt:

                                      You're aware that some compiler options and loading a plugin has nothing to do with each other? It's not needed. The only thing you need is (as I already told you) that the program finds the dependencies for your plugin, for instance the mysql dll (search the forum)

                                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                      Visit the Qt Academy at https://academy.qt.io/catalog

                                      T Christian EhrlicherC 2 Replies Last reply
                                      1
                                      • Christian EhrlicherC Christian Ehrlicher

                                        @Tamfub said in Cannot mix incompatible Qt library:

                                        If I don't include this, I get this while running my program in Qt:

                                        You're aware that some compiler options and loading a plugin has nothing to do with each other? It's not needed. The only thing you need is (as I already told you) that the program finds the dependencies for your plugin, for instance the mysql dll (search the forum)

                                        T Offline
                                        T Offline
                                        Tamfub
                                        wrote on last edited by Tamfub
                                        #24

                                        @Christian-Ehrlicher
                                        After a long time I managed to analyze the .exe on Dependency Walker, and I got this in the log window:

                                        LoadLibraryW("C:\qt\projects\tutorial\progettomalnati\sharedtexteditor\build-progettomalnati_srv_2-desktop_qt_5_15_1_mingw_64_bit-release\release\sqldrivers\qsqlmysql.dll") called from "QT5CORE.DLL" at address 0x0000000068A61823.
                                        Loaded "QSQLMYSQL.DLL" at address 0x000000006C5C0000.  Successfully hooked module.
                                        Unloaded "QSQLMYSQL.DLL" at address 0x000000006C5C0000.
                                        LoadLibraryW("C:\qt\projects\tutorial\progettomalnati\sharedtexteditor\build-progettomalnati_srv_2-desktop_qt_5_15_1_mingw_64_bit-release\release\sqldrivers\qsqlmysql.dll") returned NULL. Error: Impossibile trovare il modulo specificato (126).
                                        QSqlDatabase: QMYSQL driver not loaded
                                        QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QMYSQL3 QODBC QODBC3
                                        Errore nel collegamento al DB
                                        "Driver not loaded Driver not loaded"
                                        

                                        409b70c3-803c-4131-bfb0-db948bbcae23-image.png

                                        But this file is in the folder!
                                        236acba2-27f2-4132-8377-3bd18231ccc1-image.png

                                        1 Reply Last reply
                                        0
                                        • Christian EhrlicherC Offline
                                          Christian EhrlicherC Offline
                                          Christian Ehrlicher
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #25

                                          @Tamfub said in Cannot mix incompatible Qt library:

                                          But this file is in the folder!

                                          I know, but you don't read what I tell you (already two times) - the plugins has some dependencies to other libraries which must be available... !

                                          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                          Visit the Qt Academy at https://academy.qt.io/catalog

                                          T 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