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. How to create Qt 6.5 mysql driver with cmake?
QtWS25 Last Chance

How to create Qt 6.5 mysql driver with cmake?

Scheduled Pinned Locked Moved Unsolved General and Desktop
60 Posts 8 Posters 8.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S SGaist
    8 Jul 2023, 20:26

    @Saad02 said in How to create Qt 6.5 mysql driver with cmake?:

    @Saad02 Ok, I understood little.
    Code:
    qt-cmake -G Ninja C:/Qt/6.5.1/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=C:/Qt/<platform> -DMySQL_INCLUDE_DIR="C:/mysql-8.0.33-winx64/include" -DMySQL_LIBRARY="C:/mysql-8.0.33-winx64/lib/mysqlclient.<so|dylib>"

    Do I need to change anything here now?

    As already said several times: all the values between a < and > must be replaced by suitable values.

    S Offline
    S Offline
    Saad02
    wrote on 9 Jul 2023, 05:29 last edited by
    #17

    @SGaist Then what should I replace the <platform> and <soIdylib> with? If I am not wrong the 2nd one is ".lib".
    Also, is it possible for you to gimme the exact code that I can run directly? It seems to be a little tough for me though I tried.

    1 Reply Last reply
    0
    • S Saad02
      9 Jul 2023, 05:18

      @thecodemonkey Sir, I extracted those in my project file is it, ok? (But it didn't work)
      And did you mean any of the folder in Qt by "subdirectory "?

      Also, this code also got me the same error.

      T Offline
      T Offline
      thecodemonkey
      wrote on 9 Jul 2023, 06:16 last edited by
      #18

      @Saad02 there are two possibilites, both should work:

      1. in Qt installation dir. For MinGW that would be something like C:\Qt\6.5.1\mingw_64\plugins\sqldrivers
      2. a subdirectory in your project build path (where the compiler creates the exe file of your project), like this:
        384f1057-3474-418b-a20d-567e326c208a-grafik.png

      libmysql.dll must be accessible, too. So either copy it to your project build path, or some other path that is added to your PATH environment variable

      S 1 Reply Last reply 9 Jul 2023, 07:53
      0
      • T thecodemonkey
        9 Jul 2023, 06:16

        @Saad02 there are two possibilites, both should work:

        1. in Qt installation dir. For MinGW that would be something like C:\Qt\6.5.1\mingw_64\plugins\sqldrivers
        2. a subdirectory in your project build path (where the compiler creates the exe file of your project), like this:
          384f1057-3474-418b-a20d-567e326c208a-grafik.png

        libmysql.dll must be accessible, too. So either copy it to your project build path, or some other path that is added to your PATH environment variable

        S Offline
        S Offline
        Saad02
        wrote on 9 Jul 2023, 07:53 last edited by
        #19

        @thecodemonkey Sir, copied all files in release and debug, qmysql.lib in C:\Qt\6.5.1\mingw_64\plugins\sqldrivers and also added the folder in environment. But it didn't work.

        T 1 Reply Last reply 9 Jul 2023, 08:02
        0
        • S Saad02
          9 Jul 2023, 07:53

          @thecodemonkey Sir, copied all files in release and debug, qmysql.lib in C:\Qt\6.5.1\mingw_64\plugins\sqldrivers and also added the folder in environment. But it didn't work.

          T Offline
          T Offline
          thecodemonkey
          wrote on 9 Jul 2023, 08:02 last edited by
          #20

          @Saad02 said in How to create Qt 6.5 mysql driver with cmake?:

          But it didn't work.

          Please be more specific

          S 1 Reply Last reply 9 Jul 2023, 08:18
          0
          • T thecodemonkey
            9 Jul 2023, 08:02

            @Saad02 said in How to create Qt 6.5 mysql driver with cmake?:

            But it didn't work.

            Please be more specific

            S Offline
            S Offline
            Saad02
            wrote on 9 Jul 2023, 08:18 last edited by
            #21

            @thecodemonkey
            62be54c3-1dbd-4f20-8628-555ec7859c58-image.png
            36e33d9e-e8ee-49ed-9a81-9acb94cc1206-image.png
            e8916716-4c06-4cd6-a85e-8a7484042861-image.png
            9a22a9b9-8fc8-456b-b124-b157f97ee167-image.png

            Also, added "qsqlmysql.dll_Qt_SQL_driver_6.5.1_MinGW_11.2.0_64-bit" folder in environment variables' system variables' path.
            I have nothing to hide :)

            T 1 Reply Last reply 9 Jul 2023, 10:37
            0
            • S Saad02
              9 Jul 2023, 08:18

              @thecodemonkey
              62be54c3-1dbd-4f20-8628-555ec7859c58-image.png
              36e33d9e-e8ee-49ed-9a81-9acb94cc1206-image.png
              e8916716-4c06-4cd6-a85e-8a7484042861-image.png
              9a22a9b9-8fc8-456b-b124-b157f97ee167-image.png

              Also, added "qsqlmysql.dll_Qt_SQL_driver_6.5.1_MinGW_11.2.0_64-bit" folder in environment variables' system variables' path.
              I have nothing to hide :)

              T Offline
              T Offline
              thecodemonkey
              wrote on 9 Jul 2023, 10:37 last edited by thecodemonkey 7 Sept 2023, 10:38
              #22

              @Saad02 ok, but I meant if there are any error messages while connecting to MySQL when you run your project. And if so, did you set QT_DEBUG_PLUGINS environment variable to value 1 which might reveal the reason

              S 1 Reply Last reply 9 Jul 2023, 11:22
              0
              • T thecodemonkey
                9 Jul 2023, 10:37

                @Saad02 ok, but I meant if there are any error messages while connecting to MySQL when you run your project. And if so, did you set QT_DEBUG_PLUGINS environment variable to value 1 which might reveal the reason

                S Offline
                S Offline
                Saad02
                wrote on 9 Jul 2023, 11:22 last edited by Saad02 7 Sept 2023, 11:23
                #23

                @thecodemonkey Sir, I am providing you the qt creator messages.
                Application Output:
                QSqlDatabase: QMYSQL driver not loaded
                QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QODBC QPSQL

                Compile Output:
                C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Release
                mingw32-make[1]: Entering directory 'C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Release'
                C:\Qt\6.5.1\mingw_64\bin\uic.exe ..\database\mainwindow.ui -o ui_mainwindow.h
                g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../database -I. -IC:/Qt/6.5.1/mingw_64/include -IC:/Qt/6.5.1/mingw_64/include/QtWidgets -IC:/Qt/6.5.1/mingw_64/include/QtGui -IC:/Qt/6.5.1/mingw_64/include/QtSql -IC:/Qt/6.5.1/mingw_64/include/QtCore -Irelease -I. -I/include -IC:/Qt/6.5.1/mingw_64/mkspecs/win32-g++ -o release\main.o ..\database\main.cpp
                g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../database -I. -IC:/Qt/6.5.1/mingw_64/include -IC:/Qt/6.5.1/mingw_64/include/QtWidgets -IC:/Qt/6.5.1/mingw_64/include/QtGui -IC:/Qt/6.5.1/mingw_64/include/QtSql -IC:/Qt/6.5.1/mingw_64/include/QtCore -Irelease -I. -I/include -IC:/Qt/6.5.1/mingw_64/mkspecs/win32-g++ -o release\mainwindow.o ..\database\mainwindow.cpp
                C:\Qt\6.5.1\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include "C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Release/release/moc_predefs.h" -IC:/Qt/6.5.1/mingw_64/mkspecs/win32-g++ -I"C:/Users/Saad/Documents/qt c++/database" -IC:/Qt/6.5.1/mingw_64/include -IC:/Qt/6.5.1/mingw_64/include/QtWidgets -IC:/Qt/6.5.1/mingw_64/include/QtGui -IC:/Qt/6.5.1/mingw_64/include/QtSql -IC:/Qt/6.5.1/mingw_64/include/QtCore -I. -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -IC:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include ..\database\mainwindow.h -o release\moc_mainwindow.cpp
                g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../database -I. -IC:/Qt/6.5.1/mingw_64/include -IC:/Qt/6.5.1/mingw_64/include/QtWidgets -IC:/Qt/6.5.1/mingw_64/include/QtGui -IC:/Qt/6.5.1/mingw_64/include/QtSql -IC:/Qt/6.5.1/mingw_64/include/QtCore -Irelease -I. -I/include -IC:/Qt/6.5.1/mingw_64/mkspecs/win32-g++ -o release\moc_mainwindow.o release\moc_mainwindow.cpp
                g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\database.exe release/main.o release/mainwindow.o release/moc_mainwindow.o C:\Qt\6.5.1\mingw_64\lib\libQt6Widgets.a C:\Qt\6.5.1\mingw_64\lib\libQt6Gui.a C:\Qt\6.5.1\mingw_64\lib\libQt6Sql.a C:\Qt\6.5.1\mingw_64\lib\libQt6Core.a -lmingw32 C:\Qt\6.5.1\mingw_64\lib\libQt6EntryPoint.a -lshell32
                mingw32-make[1]: Leaving directory 'C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Release'
                17:03:21: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally.
                17:03:21: Elapsed time: 00:16.

                T 1 Reply Last reply 9 Jul 2023, 16:04
                0
                • S Saad02
                  9 Jul 2023, 11:22

                  @thecodemonkey Sir, I am providing you the qt creator messages.
                  Application Output:
                  QSqlDatabase: QMYSQL driver not loaded
                  QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QODBC QPSQL

                  Compile Output:
                  C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Release
                  mingw32-make[1]: Entering directory 'C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Release'
                  C:\Qt\6.5.1\mingw_64\bin\uic.exe ..\database\mainwindow.ui -o ui_mainwindow.h
                  g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../database -I. -IC:/Qt/6.5.1/mingw_64/include -IC:/Qt/6.5.1/mingw_64/include/QtWidgets -IC:/Qt/6.5.1/mingw_64/include/QtGui -IC:/Qt/6.5.1/mingw_64/include/QtSql -IC:/Qt/6.5.1/mingw_64/include/QtCore -Irelease -I. -I/include -IC:/Qt/6.5.1/mingw_64/mkspecs/win32-g++ -o release\main.o ..\database\main.cpp
                  g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../database -I. -IC:/Qt/6.5.1/mingw_64/include -IC:/Qt/6.5.1/mingw_64/include/QtWidgets -IC:/Qt/6.5.1/mingw_64/include/QtGui -IC:/Qt/6.5.1/mingw_64/include/QtSql -IC:/Qt/6.5.1/mingw_64/include/QtCore -Irelease -I. -I/include -IC:/Qt/6.5.1/mingw_64/mkspecs/win32-g++ -o release\mainwindow.o ..\database\mainwindow.cpp
                  C:\Qt\6.5.1\mingw_64\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include "C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Release/release/moc_predefs.h" -IC:/Qt/6.5.1/mingw_64/mkspecs/win32-g++ -I"C:/Users/Saad/Documents/qt c++/database" -IC:/Qt/6.5.1/mingw_64/include -IC:/Qt/6.5.1/mingw_64/include/QtWidgets -IC:/Qt/6.5.1/mingw_64/include/QtGui -IC:/Qt/6.5.1/mingw_64/include/QtSql -IC:/Qt/6.5.1/mingw_64/include/QtCore -I. -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include -IC:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed -IC:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include ..\database\mainwindow.h -o release\moc_mainwindow.cpp
                  g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../database -I. -IC:/Qt/6.5.1/mingw_64/include -IC:/Qt/6.5.1/mingw_64/include/QtWidgets -IC:/Qt/6.5.1/mingw_64/include/QtGui -IC:/Qt/6.5.1/mingw_64/include/QtSql -IC:/Qt/6.5.1/mingw_64/include/QtCore -Irelease -I. -I/include -IC:/Qt/6.5.1/mingw_64/mkspecs/win32-g++ -o release\moc_mainwindow.o release\moc_mainwindow.cpp
                  g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\database.exe release/main.o release/mainwindow.o release/moc_mainwindow.o C:\Qt\6.5.1\mingw_64\lib\libQt6Widgets.a C:\Qt\6.5.1\mingw_64\lib\libQt6Gui.a C:\Qt\6.5.1\mingw_64\lib\libQt6Sql.a C:\Qt\6.5.1\mingw_64\lib\libQt6Core.a -lmingw32 C:\Qt\6.5.1\mingw_64\lib\libQt6EntryPoint.a -lshell32
                  mingw32-make[1]: Leaving directory 'C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Release'
                  17:03:21: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally.
                  17:03:21: Elapsed time: 00:16.

                  T Offline
                  T Offline
                  thecodemonkey
                  wrote on 9 Jul 2023, 16:04 last edited by
                  #24

                  @Saad02 I don't see the output that is printed if the environment variable QT_DEBUG_PLUGINS=1 is set. Could you run the project as debug build?

                  S 1 Reply Last reply 9 Jul 2023, 21:09
                  0
                  • T thecodemonkey
                    9 Jul 2023, 16:04

                    @Saad02 I don't see the output that is printed if the environment variable QT_DEBUG_PLUGINS=1 is set. Could you run the project as debug build?

                    S Offline
                    S Offline
                    Saad02
                    wrote on 9 Jul 2023, 21:09 last edited by
                    #25

                    @thecodemonkey Nothing changed. I got the same output. Do I have to somewhere else except Qt Creator?

                    J 1 Reply Last reply 10 Jul 2023, 05:31
                    0
                    • S Saad02
                      9 Jul 2023, 21:09

                      @thecodemonkey Nothing changed. I got the same output. Do I have to somewhere else except Qt Creator?

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 10 Jul 2023, 05:31 last edited by
                      #26

                      @Saad02 said in How to create Qt 6.5 mysql driver with cmake?:

                      Do I have to somewhere else except Qt Creator?

                      No, you just need to do it properly. You need to set QT_DEBUG_PLUGINS=1 in Run settings of your project in QtCreator.

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

                      S 1 Reply Last reply 10 Jul 2023, 11:27
                      0
                      • J jsulm
                        10 Jul 2023, 05:31

                        @Saad02 said in How to create Qt 6.5 mysql driver with cmake?:

                        Do I have to somewhere else except Qt Creator?

                        No, you just need to do it properly. You need to set QT_DEBUG_PLUGINS=1 in Run settings of your project in QtCreator.

                        S Offline
                        S Offline
                        Saad02
                        wrote on 10 Jul 2023, 11:27 last edited by
                        #27

                        @jsulm Sir, you mean that file with ".pro" extension right?
                        database.pro:
                        QT += core gui sql

                        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                        CONFIG += c++17
                        QT_DEBUG_PLUGINS=1

                        You can make your code fail to compile if it uses deprecated APIs.

                        In order to do so, uncomment the following line.

                        #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

                        SOURCES +=
                        main.cpp
                        mainwindow.cpp

                        HEADERS +=
                        mainwindow.h

                        FORMS +=
                        mainwindow.ui

                        Default rules for deployment.

                        qnx: target.path = /tmp/$${TARGET}/bin
                        else: unix:!android: target.path = /opt/$${TARGET}/bin
                        !isEmpty(target.path): INSTALLS += target

                        Nothing changed!

                        J 1 Reply Last reply 10 Jul 2023, 11:39
                        0
                        • S Saad02
                          10 Jul 2023, 11:27

                          @jsulm Sir, you mean that file with ".pro" extension right?
                          database.pro:
                          QT += core gui sql

                          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                          CONFIG += c++17
                          QT_DEBUG_PLUGINS=1

                          You can make your code fail to compile if it uses deprecated APIs.

                          In order to do so, uncomment the following line.

                          #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

                          SOURCES +=
                          main.cpp
                          mainwindow.cpp

                          HEADERS +=
                          mainwindow.h

                          FORMS +=
                          mainwindow.ui

                          Default rules for deployment.

                          qnx: target.path = /tmp/$${TARGET}/bin
                          else: unix:!android: target.path = /opt/$${TARGET}/bin
                          !isEmpty(target.path): INSTALLS += target

                          Nothing changed!

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 10 Jul 2023, 11:39 last edited by
                          #28

                          @Saad02 said in How to create Qt 6.5 mysql driver with cmake?:

                          you mean that file with ".pro" extension right?

                          No, I did not say a single word about the pro file.
                          You were asked to set QT_DEBUG_PLUGINS anvironment variable to 1 before starting your application.
                          You can set it in QtCreator if you go to "Projects/Build & Run/Run/Run Environment".

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

                          S 1 Reply Last reply 10 Jul 2023, 18:36
                          0
                          • J jsulm
                            10 Jul 2023, 11:39

                            @Saad02 said in How to create Qt 6.5 mysql driver with cmake?:

                            you mean that file with ".pro" extension right?

                            No, I did not say a single word about the pro file.
                            You were asked to set QT_DEBUG_PLUGINS anvironment variable to 1 before starting your application.
                            You can set it in QtCreator if you go to "Projects/Build & Run/Run/Run Environment".

                            S Offline
                            S Offline
                            Saad02
                            wrote on 10 Jul 2023, 18:36 last edited by
                            #29

                            @jsulm Sir, I don't have "run environment" in run...
                            ca4fc873-5149-4f0e-957d-519b7ba1b168-image.png

                            J 1 Reply Last reply 11 Jul 2023, 05:56
                            0
                            • S Saad02
                              10 Jul 2023, 18:36

                              @jsulm Sir, I don't have "run environment" in run...
                              ca4fc873-5149-4f0e-957d-519b7ba1b168-image.png

                              J Offline
                              J Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 11 Jul 2023, 05:56 last edited by
                              #30

                              @Saad02 said in How to create Qt 6.5 mysql driver with cmake?:

                              I don't have "run environment" in run

                              Of course you have, you just need to look bellow the part you posted, really...

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

                              S 1 Reply Last reply 11 Jul 2023, 19:46
                              0
                              • J jsulm
                                11 Jul 2023, 05:56

                                @Saad02 said in How to create Qt 6.5 mysql driver with cmake?:

                                I don't have "run environment" in run

                                Of course you have, you just need to look bellow the part you posted, really...

                                S Offline
                                S Offline
                                Saad02
                                wrote on 11 Jul 2023, 19:46 last edited by
                                #31

                                @jsulm Sir, the red marked one showing me my system variables, not run environment variable.
                                1eb5abed-37d9-483e-bfc9-5ffbc2fcd279-image.png
                                And this is the rest-
                                c73f879f-e8bb-454a-a669-f902f1bbf016-image.png
                                Here is all I have in "run".
                                By the way, the internet connection in our local is currently unstable. Can it be the reason for that driver not to load?

                                S 1 Reply Last reply 11 Jul 2023, 19:52
                                0
                                • S Saad02
                                  11 Jul 2023, 19:46

                                  @jsulm Sir, the red marked one showing me my system variables, not run environment variable.
                                  1eb5abed-37d9-483e-bfc9-5ffbc2fcd279-image.png
                                  And this is the rest-
                                  c73f879f-e8bb-454a-a669-f902f1bbf016-image.png
                                  Here is all I have in "run".
                                  By the way, the internet connection in our local is currently unstable. Can it be the reason for that driver not to load?

                                  S Offline
                                  S Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on 11 Jul 2023, 19:52 last edited by
                                  #32

                                  @Saad02 do you see the arrow at the far right ? Click on it to show the variables.

                                  Plugin loading and internet connection are unrelated

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

                                  S 1 Reply Last reply 12 Jul 2023, 10:11
                                  1
                                  • S SGaist
                                    11 Jul 2023, 19:52

                                    @Saad02 do you see the arrow at the far right ? Click on it to show the variables.

                                    Plugin loading and internet connection are unrelated

                                    S Offline
                                    S Offline
                                    Saad02
                                    wrote on 12 Jul 2023, 10:11 last edited by
                                    #33

                                    @SGaist Sir, it is showing me my system variable. Not "run variable". I think I am doing something wrong. Should I reinstall QT? And what version should I install?
                                    6a23905a-0075-44e0-856a-eb55bcbfb177-image.png

                                    JonBJ 1 Reply Last reply 12 Jul 2023, 11:29
                                    0
                                    • S Saad02
                                      12 Jul 2023, 10:11

                                      @SGaist Sir, it is showing me my system variable. Not "run variable". I think I am doing something wrong. Should I reinstall QT? And what version should I install?
                                      6a23905a-0075-44e0-856a-eb55bcbfb177-image.png

                                      JonBJ Offline
                                      JonBJ Offline
                                      JonB
                                      wrote on 12 Jul 2023, 11:29 last edited by
                                      #34

                                      @Saad02
                                      It seems to clearly show your Run environment, and that by default is the same as your System environment.

                                      You have been asked to add a QT_DEBUG_PLUGINS environment variable into the Run environment, so do so.

                                      Or, just run your executable from a terminal shell and add the environment variable there.

                                      S 1 Reply Last reply 12 Jul 2023, 12:29
                                      0
                                      • JonBJ JonB
                                        12 Jul 2023, 11:29

                                        @Saad02
                                        It seems to clearly show your Run environment, and that by default is the same as your System environment.

                                        You have been asked to add a QT_DEBUG_PLUGINS environment variable into the Run environment, so do so.

                                        Or, just run your executable from a terminal shell and add the environment variable there.

                                        S Offline
                                        S Offline
                                        Saad02
                                        wrote on 12 Jul 2023, 12:29 last edited by
                                        #35

                                        @JonB Done and nothing much happened.
                                        3085b636-941b-46f4-915e-58c3cfa84a4d-image.png
                                        Application Output:
                                        QSqlDatabase: QMYSQL driver not loaded
                                        QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QODBC QPSQL

                                        Compile Output:
                                        18:27:06: Running steps for project database...
                                        18:27:06: Starting: "C:\Qt\6.5.1\mingw_64\bin\qmake.exe" "C:\Users\Saad\Documents\qt c++\database\database.pro" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
                                        18:27:10: The process "C:\Qt\6.5.1\mingw_64\bin\qmake.exe" exited normally.
                                        18:27:10: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -f "C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Debug/Makefile" qmake_all
                                        mingw32-make: Nothing to be done for 'qmake_all'.
                                        18:27:10: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally.
                                        18:27:10: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j4
                                        C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
                                        mingw32-make[1]: Entering directory 'C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Debug'
                                        mingw32-make[1]: Nothing to be done for 'first'.
                                        mingw32-make[1]: Leaving directory 'C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Debug'
                                        18:27:11: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally.
                                        18:27:11: Elapsed time: 00:05.

                                        JonBJ J 2 Replies Last reply 12 Jul 2023, 13:13
                                        0
                                        • S Saad02
                                          12 Jul 2023, 12:29

                                          @JonB Done and nothing much happened.
                                          3085b636-941b-46f4-915e-58c3cfa84a4d-image.png
                                          Application Output:
                                          QSqlDatabase: QMYSQL driver not loaded
                                          QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QODBC QPSQL

                                          Compile Output:
                                          18:27:06: Running steps for project database...
                                          18:27:06: Starting: "C:\Qt\6.5.1\mingw_64\bin\qmake.exe" "C:\Users\Saad\Documents\qt c++\database\database.pro" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
                                          18:27:10: The process "C:\Qt\6.5.1\mingw_64\bin\qmake.exe" exited normally.
                                          18:27:10: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -f "C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Debug/Makefile" qmake_all
                                          mingw32-make: Nothing to be done for 'qmake_all'.
                                          18:27:10: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally.
                                          18:27:10: Starting: "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j4
                                          C:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
                                          mingw32-make[1]: Entering directory 'C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Debug'
                                          mingw32-make[1]: Nothing to be done for 'first'.
                                          mingw32-make[1]: Leaving directory 'C:/Users/Saad/Documents/qt c++/build-database-Desktop_Qt_6_5_1_MinGW_64_bit-Debug'
                                          18:27:11: The process "C:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" exited normally.
                                          18:27:11: Elapsed time: 00:05.

                                          JonBJ Offline
                                          JonBJ Offline
                                          JonB
                                          wrote on 12 Jul 2023, 13:13 last edited by
                                          #36

                                          @Saad02
                                          I can only say that, although you seem to have done the right thing, this is not correct output when setting QT_DEBUG_PLUGINS=1. You can verify that by searching the hundreds of occasions it has been used in this forum's questions or on the web.

                                          Since I don't know exactly about Creator I suggest you set it in a shell and run your executable from there.

                                          JonBJ 1 Reply Last reply 13 Jul 2023, 09:32
                                          0

                                          26/60

                                          10 Jul 2023, 05:31

                                          • Login

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