Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QTDriver not Load
Forum Updated to NodeBB v4.3 + New Features

QTDriver not Load

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
33 Posts 6 Posters 11.0k 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.
  • L Offline
    L Offline
    lucaynnofrota
    wrote on last edited by
    #13

    I have tried this but it doesn't work. It's the same output.

    jsulmJ 1 Reply Last reply
    0
    • L lucaynnofrota

      I have tried this but it doesn't work. It's the same output.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #14

      @lucaynnofrota Do you follow this: http://doc.qt.io/qt-5/sql-driver.html ?

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

      L 1 Reply Last reply
      0
      • jsulmJ jsulm

        @lucaynnofrota Do you follow this: http://doc.qt.io/qt-5/sql-driver.html ?

        L Offline
        L Offline
        lucaynnofrota
        wrote on last edited by
        #15

        @jsulm

        Yeah.
        I have added to the PATH C:\Qt\Tools\mingw530_32\bin and C:\Qt\5.10.1\mingw53_32\bin
        And then i executed this .bat file:

        set mysql=C:\Program Files\MySQL
        cd D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
        qmake "INCLUDEPATH+=%mysql%\\MySQL Server 8.0\\include\\mysql.h" "LIBS+=%mysql%\\MySQL Server 8.0\\lib\\libmysql.dll"  -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
        
        nmake sub-mysql
        
        pause
        

        the output is:

        Qt Sql:
          DB2 (IBM) .............................. no
          InterBase .............................. no
          MySql .................................. no
          OCI (Oracle) ........................... no
          ODBC ................................... yes
          PostgreSQL ............................. no
          SQLite2 ................................ no
          SQLite ................................. yes
            Using system provided SQLite ......... no
          TDS (Sybase) ........................... no
        
        
        jsulmJ 1 Reply Last reply
        0
        • L lucaynnofrota

          @jsulm

          Yeah.
          I have added to the PATH C:\Qt\Tools\mingw530_32\bin and C:\Qt\5.10.1\mingw53_32\bin
          And then i executed this .bat file:

          set mysql=C:\Program Files\MySQL
          cd D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
          qmake "INCLUDEPATH+=%mysql%\\MySQL Server 8.0\\include\\mysql.h" "LIBS+=%mysql%\\MySQL Server 8.0\\lib\\libmysql.dll"  -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
          
          nmake sub-mysql
          
          pause
          

          the output is:

          Qt Sql:
            DB2 (IBM) .............................. no
            InterBase .............................. no
            MySql .................................. no
            OCI (Oracle) ........................... no
            ODBC ................................... yes
            PostgreSQL ............................. no
            SQLite2 ................................ no
            SQLite ................................. yes
              Using system provided SQLite ......... no
            TDS (Sybase) ........................... no
          
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #16

          @lucaynnofrota said in QTDriver not Load:

          set mysql=C:\Program Files\MySQL

          You should avoid using paths with spaces.

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

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

            To add to @jsulm or at least you should quote them properly.

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

            1 Reply Last reply
            2
            • JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #18

              @lucaynnofrota
              I'm lost: Is your problem still that you don't start out in the right directory for your qmake command?? Because you have been showing lines like:

              C:\Users\lucya\Desktop\Qt Driver>cd D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
              
              C:\Users\lucya\Desktop\Qt Driver>qmake "INCLUDEPATH+=C:\Program Files\MySQL\MySQL Server 8.0\\include" "LIBS+=C:\Program Files\MySQL\MySQL Server 8.0\\lib\\libmysql.lib" -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
              

              Given that you seem to want to change the current directory to a path on a different drive from where you are, what do you think your first cd is accomplishing? On Windows/DOS it does not change the "current" directory (as you can see from the second line's prompt), it only changes the default directory on the other drive (D:).

              You have to use cd /d ... or pushd ..., or go D:, if drive letter is different from current drive, if you want to change "the current directory" for the qmake.

              Is this what this is all about?? Or maybe I'm going mad or don't have a clue what the issue is :)

              L 1 Reply Last reply
              1
              • JonBJ JonB

                @lucaynnofrota
                I'm lost: Is your problem still that you don't start out in the right directory for your qmake command?? Because you have been showing lines like:

                C:\Users\lucya\Desktop\Qt Driver>cd D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
                
                C:\Users\lucya\Desktop\Qt Driver>qmake "INCLUDEPATH+=C:\Program Files\MySQL\MySQL Server 8.0\\include" "LIBS+=C:\Program Files\MySQL\MySQL Server 8.0\\lib\\libmysql.lib" -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
                

                Given that you seem to want to change the current directory to a path on a different drive from where you are, what do you think your first cd is accomplishing? On Windows/DOS it does not change the "current" directory (as you can see from the second line's prompt), it only changes the default directory on the other drive (D:).

                You have to use cd /d ... or pushd ..., or go D:, if drive letter is different from current drive, if you want to change "the current directory" for the qmake.

                Is this what this is all about?? Or maybe I'm going mad or don't have a clue what the issue is :)

                L Offline
                L Offline
                lucaynnofrota
                wrote on last edited by
                #19

                @JonB
                I forgot this. But i think this is not the problem. Because i can copy the files to correctly directory.
                Anyway, i changed the code!

                Thaks for reply

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @lucaynnofrota said in QTDriver not Load:

                  set mysql=C:\Program Files\MySQL

                  You should avoid using paths with spaces.

                  L Offline
                  L Offline
                  lucaynnofrota
                  wrote on last edited by
                  #20

                  @jsulm
                  Thanks for reply
                  I copied the files of interest to another folder to try to build. But it did not work.
                  Input:

                  d:
                  cd D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
                  qmake "INCLUDEPATH+=C:\Users\lucya\Desktop\Qt_Driver\include" "LIBS+=C:\Users\lucya\Desktop\Qt_Driver\libs"  -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
                  nmake C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql
                  
                  pause
                  

                  Output:

                  D:\>cd D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
                  
                  D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\Users\lucya\Desktop\Qt_Driver\include" "LIBS+=C:\Users\lucya\Desktop\Qt_Driver\libs"  -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
                  Info: creating stash file D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql\.qmake.stash
                  
                  Running configuration tests...
                  Checking for DB2 (IBM)... no
                  Checking for InterBase... no
                  Checking for MySQL... no
                  Checking for OCI (Oracle)... no
                  Checking for ODBC... yes
                  Checking for PostgreSQL... no
                  Checking for SQLite (version 2)... no
                  Checking for TDS (Sybase)... no
                  Done running configuration tests.
                  
                  Configure summary:
                  
                  Qt Sql:
                    DB2 (IBM) .............................. no
                    InterBase .............................. no
                    MySql .................................. no
                    OCI (Oracle) ........................... no
                    ODBC ................................... yes
                    PostgreSQL ............................. no
                    SQLite2 ................................ no
                    SQLite ................................. yes
                      Using system provided SQLite ......... no
                    TDS (Sybase) ........................... no
                  
                  Qt is now configured for building. Just run 'mingw32-make'.
                  Once everything is built, Qt is installed.
                  You should NOT run 'mingw32-make install'.
                  Note that this build cannot be deployed to other machines or devices.
                  
                  Prior to reconfiguration, make sure you remove any leftovers from
                  the previous build.
                  
                  
                  D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>nmake C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql
                  
                  Microsoft (R) Program Maintenance Utility Version 14.16.27023.1
                  Copyright (C) Microsoft Corporation.  All rights reserved.
                  
                  NMAKE : fatal error U1073: don't know how to make 'C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql'
                  Stop.
                  
                  D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>pause
                  

                  What is "sub" in documentation?

                  jsulmJ 1 Reply Last reply
                  0
                  • L lucaynnofrota

                    @jsulm
                    Thanks for reply
                    I copied the files of interest to another folder to try to build. But it did not work.
                    Input:

                    d:
                    cd D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
                    qmake "INCLUDEPATH+=C:\Users\lucya\Desktop\Qt_Driver\include" "LIBS+=C:\Users\lucya\Desktop\Qt_Driver\libs"  -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
                    nmake C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql
                    
                    pause
                    

                    Output:

                    D:\>cd D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql
                    
                    D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=C:\Users\lucya\Desktop\Qt_Driver\include" "LIBS+=C:\Users\lucya\Desktop\Qt_Driver\libs"  -o Makefile D:\Qt\5.11.2\Src\qtbase\src\plugins\sqldrivers\
                    Info: creating stash file D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql\.qmake.stash
                    
                    Running configuration tests...
                    Checking for DB2 (IBM)... no
                    Checking for InterBase... no
                    Checking for MySQL... no
                    Checking for OCI (Oracle)... no
                    Checking for ODBC... yes
                    Checking for PostgreSQL... no
                    Checking for SQLite (version 2)... no
                    Checking for TDS (Sybase)... no
                    Done running configuration tests.
                    
                    Configure summary:
                    
                    Qt Sql:
                      DB2 (IBM) .............................. no
                      InterBase .............................. no
                      MySql .................................. no
                      OCI (Oracle) ........................... no
                      ODBC ................................... yes
                      PostgreSQL ............................. no
                      SQLite2 ................................ no
                      SQLite ................................. yes
                        Using system provided SQLite ......... no
                      TDS (Sybase) ........................... no
                    
                    Qt is now configured for building. Just run 'mingw32-make'.
                    Once everything is built, Qt is installed.
                    You should NOT run 'mingw32-make install'.
                    Note that this build cannot be deployed to other machines or devices.
                    
                    Prior to reconfiguration, make sure you remove any leftovers from
                    the previous build.
                    
                    
                    D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>nmake C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql
                    
                    Microsoft (R) Program Maintenance Utility Version 14.16.27023.1
                    Copyright (C) Microsoft Corporation.  All rights reserved.
                    
                    NMAKE : fatal error U1073: don't know how to make 'C:\Program~Files\MySQL\MySQL~Server~8.0\include\mysql'
                    Stop.
                    
                    D:\Qt\5.12.0\Src\qtbase\src\plugins\sqldrivers\mysql>pause
                    

                    What is "sub" in documentation?

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #21

                    @lucaynnofrota said in QTDriver not Load:

                    What is "sub" in documentation?

                    What sub do you mean?

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

                    L 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @lucaynnofrota said in QTDriver not Load:

                      What is "sub" in documentation?

                      What sub do you mean?

                      L Offline
                      L Offline
                      lucaynnofrota
                      wrote on last edited by
                      #22

                      @jsulm

                      Thanks for reply
                      http://doc.qt.io/qt-5/sql-driver.html
                      Exist this code in documentation

                      cd $QTDIR/qtbase/src/plugins/sqldrivers
                      qmake -- MYSQL_PREFIX=/usr/local
                      make sub-mysql
                      

                      What is this "sub"?

                      jsulmJ 1 Reply Last reply
                      0
                      • L lucaynnofrota

                        @jsulm

                        Thanks for reply
                        http://doc.qt.io/qt-5/sql-driver.html
                        Exist this code in documentation

                        cd $QTDIR/qtbase/src/plugins/sqldrivers
                        qmake -- MYSQL_PREFIX=/usr/local
                        make sub-mysql
                        

                        What is this "sub"?

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #23

                        @lucaynnofrota It is a build target. Open the generated Makefile and search for sub-mysql there.

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

                        1 Reply Last reply
                        0
                        • kmyukieK Offline
                          kmyukieK Offline
                          kmyukie
                          wrote on last edited by kmyukie
                          #24

                          Hello, I have the same problem as @lucaynnofrota. I think I might be using the wrong commands to compile the MySQL plugin, although I have tried to follow the documentation. I'm on a Mac.
                          I've inputted in Terminal:

                          cd /Volumes/Potato/apps/5.11.2/Src/qtbase/src/plugins/sqldrivers
                          qmake -- MYSQL_PREFIX=/usr/local/mysql
                          make sub-mysql
                          

                          In which "apps" is the Qt folder I've accidentally renamed.
                          But whenever I try to execute this:

                          #include <iostream>
                          #include <QtSql>
                          #include <QtCore>
                          #include <QString>
                          #include <QCoreApplication>
                          using namespace std;
                          
                          int main(int argc,char *argv[])
                          {
                                 QCoreApplication a(argc,argv);
                          
                                 QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
                                 bool ok = db.open();
                                 if(ok) cout << "OK!\n";
                                 qDebug() << db.lastError();
                          }
                          

                          I get :

                          QSqlDatabase: QMYSQL driver not loaded
                          QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                          QSqlError("", "Driver not loaded", "Driver not loaded")
                          

                          My .pro file is:

                          TEMPLATE = app
                          CONFIG += console c++11
                          CONFIG -= app_bundle
                          CONFIG += qt
                          QT += sql gui
                          SOURCES += \
                                  main.cpp
                          

                          What am I doing wrong?
                          Thanks!

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

                            Hi,

                            Add the QT_DEBUG_PLUGINS environment variable in the Run part of the Project panel. You'll have more information about why the plugins doesn't load. A wild guess would be that the application can't find the MySQL dlls at run time.

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

                            1 Reply Last reply
                            1
                            • kmyukieK Offline
                              kmyukieK Offline
                              kmyukie
                              wrote on last edited by
                              #26

                              Thanks for replying!
                              I've tried to set QT_DEBUG_PLUGINS to 1, and the output is:

                              cd /; /Volumes/Potato/apps/Qt\ Creator.app/Contents/MacOS/../Resources/qtcreator_process_stub run /var/folders/sv/76q4jsns75g48tkx3b4g__3c0000gn/T/QtCreator.kFAuXu/stub-socket Press\ \<RETURN\>\ to\ close\ this\ window... /Users/yukie/build-testsqlite-Desktop_Qt_5_11_2_clang_64bit-Release /var/folders/sv/76q4jsns75g48tkx3b4g__3c0000gn/T/QtCreator.KiilXk 23590 /Users/yukie/build-testsqlite-Desktop_Qt_5_11_2_clang_64bit-Release/testsqlite
                              QFactoryLoader::QFactoryLoader() checking directory path "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers" ...
                              QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlite.dylib"
                              Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlite.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QSQLITE"
                                      ]
                                  },
                                  "className": "QSQLiteDriverPlugin",
                                  "debug": false,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QSQLITE")
                              QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib"
                              Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QSQLITE"
                                      ]
                                  },
                                  "className": "QSQLiteDriverPlugin",
                                  "debug": true,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QSQLITE")
                              QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib"
                              Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QMYSQL3",
                                          "QMYSQL"
                                      ]
                                  },
                                  "className": "QMYSQLDriverPlugin",
                                  "debug": false,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                              QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib"
                              Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QMYSQL3",
                                          "QMYSQL"
                                      ]
                                  },
                                  "className": "QMYSQLDriverPlugin",
                                  "debug": true,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                              QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql.dylib"
                              Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QPSQL7",
                                          "QPSQL"
                                      ]
                                  },
                                  "className": "QPSQLDriverPlugin",
                                  "debug": false,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QPSQL7", "QPSQL")
                              QFactoryLoader::QFactoryLoader() looking at "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib"
                              Found metadata in lib /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QPSQL7",
                                          "QPSQL"
                                      ]
                                  },
                                  "className": "QPSQLDriverPlugin",
                                  "debug": true,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QPSQL7", "QPSQL")
                              QFactoryLoader::QFactoryLoader() checking directory path "/Users/yukie/build-testsqlite-Desktop_Qt_5_11_2_clang_64bit-Release/sqldrivers" ...
                              Cannot load library /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 133): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib
                                Referenced from: /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
                                Reason: image not found)
                              QLibraryPrivate::loadPlugin failed on "/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib" : "Cannot load library /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 133): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib\n  Referenced from: /Volumes/Potato/apps/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib\n  Reason: image not found)"
                              QSqlDatabase: QMYSQL driver not loaded
                              QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                              QSqlError("", "Driver not loaded", "Driver not loaded")
                              QSqlQuery::prepare: database not open
                              QSqlQuery::prepare: database not open
                              QSqlQuery::prepare: database not open
                              
                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #27

                                I didn't realise that you are working on macOS. This thread is for Windows.

                                As for your issue, it has already been answered many times already on this forum. Please search it.

                                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
                                • kmyukieK kmyukie

                                  Hello, I have the same problem as @lucaynnofrota. I think I might be using the wrong commands to compile the MySQL plugin, although I have tried to follow the documentation. I'm on a Mac.
                                  I've inputted in Terminal:

                                  cd /Volumes/Potato/apps/5.11.2/Src/qtbase/src/plugins/sqldrivers
                                  qmake -- MYSQL_PREFIX=/usr/local/mysql
                                  make sub-mysql
                                  

                                  In which "apps" is the Qt folder I've accidentally renamed.
                                  But whenever I try to execute this:

                                  #include <iostream>
                                  #include <QtSql>
                                  #include <QtCore>
                                  #include <QString>
                                  #include <QCoreApplication>
                                  using namespace std;
                                  
                                  int main(int argc,char *argv[])
                                  {
                                         QCoreApplication a(argc,argv);
                                  
                                         QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
                                         bool ok = db.open();
                                         if(ok) cout << "OK!\n";
                                         qDebug() << db.lastError();
                                  }
                                  

                                  I get :

                                  QSqlDatabase: QMYSQL driver not loaded
                                  QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                                  QSqlError("", "Driver not loaded", "Driver not loaded")
                                  

                                  My .pro file is:

                                  TEMPLATE = app
                                  CONFIG += console c++11
                                  CONFIG -= app_bundle
                                  CONFIG += qt
                                  QT += sql gui
                                  SOURCES += \
                                          main.cpp
                                  

                                  What am I doing wrong?
                                  Thanks!

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #28

                                  @kmyukie Didn't you forgot "make install"?

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

                                  1 Reply Last reply
                                  0
                                  • jsulmJ jsulm

                                    @lucaynnofrota said in QTDriver not Load:

                                    D:/Qt/5.11.2/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri

                                    Does this file exist?

                                    A Offline
                                    A Offline
                                    ankurboruah
                                    wrote on last edited by
                                    #29

                                    @jsulm I had the same issue as @lucaynnofrota where the qtsqldrivers-config.pri file was not found. Any idea where I can find the file?

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

                                      @ankurboruah This file is created when you configure Qt.

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

                                      A 1 Reply Last reply
                                      0
                                      • SGaistS SGaist

                                        @ankurboruah This file is created when you configure Qt.

                                        A Offline
                                        A Offline
                                        ankurboruah
                                        wrote on last edited by
                                        #31

                                        @SGaist Thanks for your reply. I came to the same conclusion as well. Going through with configuring Qt. Hopefully no errors pop up during that.

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

                                          Which version of Qt are you trying to build the driver for ?

                                          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

                                          • Login

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