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. Deploy qt desktop app 'Driver not loaded'
Forum Updated to NodeBB v4.3 + New Features

Deploy qt desktop app 'Driver not loaded'

Scheduled Pinned Locked Moved Solved Installation and Deployment
24 Posts 3 Posters 3.8k Views 1 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #11

    The ODBC failure you had was because of a missing QCoreApplication based object.

    Your current error comes from the fact that you are trying to show a widget while you created only a QCoreApplication. Qt widgets requires a QApplication object.

    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

      The ODBC failure you had was because of a missing QCoreApplication based object.

      Your current error comes from the fact that you are trying to show a widget while you created only a QCoreApplication. Qt widgets requires a QApplication object.

      A Offline
      A Offline
      AdrianN17
      wrote on last edited by AdrianN17
      #12

      @SGaist I don´t understand , do you mean this error to QODBC?

      QSqlDatabase: QMYSQL driver not loaded
      QSqlDatabase: available drivers:
      QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
      "Driver not loaded Driver not loaded"

      This is QMYSQL error when I deploy my app and run. QTCreator gives me a better error report instead of opening my .exe app

      Sorry if I also confused him by using 2 drivers

      • QMYSQL work fine with qtcreator, but no after deployment

      • QODBC only open database in qtcreator , but no work SELECT (I use the same queries for both)

      Conection file conexion.cpp

      #include "conexion.h"
      
      conexion::conexion()
      {
      
      }
      
      QSqlDatabase conexion::conecta()
      {
          /*QSqlDatabase db;
          db = QSqlDatabase::addDatabase("QMYSQL");
          db.setHostName("localhost");
          db.setUserName("root");
          db.setPassword("");
          db.setDatabaseName("tunqui_restaurante");*/
      
          QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
          db.setDatabaseName("Driver={MySQL ODBC 8.0 ANSI Driver};Server=localhost;DATABASE=tunqui_restaurante;");
          db.setUserName("root");
          db.setPassword("");
      
      
          if (db.open()){
               qDebug() << "true";
          }
          else {
              qDebug() << db.lastError().text();
          }
      
          return db;
      }
      

      Conection file conexion.h

      #ifndef CONEXION_H
      #define CONEXION_H
      
      #include <QtSql>
      
      
      class conexion
      {
      public:
          conexion();
          QSqlDatabase conecta();
      };
      
      #endif // CONEXION_H
      

      controller file controlador.cpp

      #include "controlador.h"
      
      controlador::controlador()
      {
      
      }
      
      static QSqlDatabase con=conexion().conecta();
      
      //ingresar
      
      usuario controlador::logear(acceso ac)
      {
          usuario us= usuario();
      
          QSqlQuery query(con);
      
          QString sentence= "SELECT ID_usuario,nombre,apellido,dni,telefono,correo,cargo,direccion FROM usuario WHERE user = :user and pass = :pass; ";
          query.prepare(sentence);
          query.bindValue(":user",ac.get_user());
          query.bindValue(":pass",ac.get_pass());
      
      
          query.exec();
      
      
          if (query.size()>0)
          {
              while(query.next())
              {
                  us.set_ID_usuario(query.value("ID_usuario").toInt());
                  us.set_nombre(query.value("nombre").toString());
                  us.set_apellido(query.value("apellido").toString());
                  us.set_dni(query.value("dni").toString());
                  us.set_telefono(query.value("telefono").toString());
                  us.set_correo(query.value("correo").toString());
                  us.set_cargo(query.value("cargo").toInt());
                  us.set_direccion(query.value("direccion").toString());
      
              }
          }
      
      
          return us;
      }
      
      jsulmJ 1 Reply Last reply
      0
      • A AdrianN17

        @SGaist I don´t understand , do you mean this error to QODBC?

        QSqlDatabase: QMYSQL driver not loaded
        QSqlDatabase: available drivers:
        QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
        "Driver not loaded Driver not loaded"

        This is QMYSQL error when I deploy my app and run. QTCreator gives me a better error report instead of opening my .exe app

        Sorry if I also confused him by using 2 drivers

        • QMYSQL work fine with qtcreator, but no after deployment

        • QODBC only open database in qtcreator , but no work SELECT (I use the same queries for both)

        Conection file conexion.cpp

        #include "conexion.h"
        
        conexion::conexion()
        {
        
        }
        
        QSqlDatabase conexion::conecta()
        {
            /*QSqlDatabase db;
            db = QSqlDatabase::addDatabase("QMYSQL");
            db.setHostName("localhost");
            db.setUserName("root");
            db.setPassword("");
            db.setDatabaseName("tunqui_restaurante");*/
        
            QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
            db.setDatabaseName("Driver={MySQL ODBC 8.0 ANSI Driver};Server=localhost;DATABASE=tunqui_restaurante;");
            db.setUserName("root");
            db.setPassword("");
        
        
            if (db.open()){
                 qDebug() << "true";
            }
            else {
                qDebug() << db.lastError().text();
            }
        
            return db;
        }
        

        Conection file conexion.h

        #ifndef CONEXION_H
        #define CONEXION_H
        
        #include <QtSql>
        
        
        class conexion
        {
        public:
            conexion();
            QSqlDatabase conecta();
        };
        
        #endif // CONEXION_H
        

        controller file controlador.cpp

        #include "controlador.h"
        
        controlador::controlador()
        {
        
        }
        
        static QSqlDatabase con=conexion().conecta();
        
        //ingresar
        
        usuario controlador::logear(acceso ac)
        {
            usuario us= usuario();
        
            QSqlQuery query(con);
        
            QString sentence= "SELECT ID_usuario,nombre,apellido,dni,telefono,correo,cargo,direccion FROM usuario WHERE user = :user and pass = :pass; ";
            query.prepare(sentence);
            query.bindValue(":user",ac.get_user());
            query.bindValue(":pass",ac.get_pass());
        
        
            query.exec();
        
        
            if (query.size()>0)
            {
                while(query.next())
                {
                    us.set_ID_usuario(query.value("ID_usuario").toInt());
                    us.set_nombre(query.value("nombre").toString());
                    us.set_apellido(query.value("apellido").toString());
                    us.set_dni(query.value("dni").toString());
                    us.set_telefono(query.value("telefono").toString());
                    us.set_correo(query.value("correo").toString());
                    us.set_cargo(query.value("cargo").toInt());
                    us.set_direccion(query.value("direccion").toString());
        
                }
            }
        
        
            return us;
        }
        
        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #13

        @AdrianN17

        int main(int argc, char *argv[])
        {
        QApplication a(argc, argv); // <--- HERE
        login w;
        w.show();
        
        return a.exec();
        
        }
        
        
        

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

        A 1 Reply Last reply
        0
        • jsulmJ jsulm

          @AdrianN17

          int main(int argc, char *argv[])
          {
          QApplication a(argc, argv); // <--- HERE
          login w;
          w.show();
          
          return a.exec();
          
          }
          
          
          
          A Offline
          A Offline
          AdrianN17
          wrote on last edited by AdrianN17
          #14

          @jsulm said in Deploy qt desktop app 'Driver not loaded':

          int main(int argc, char *argv[])
          {
          QApplication a(argc, argv); // <--- HERE
          login w;
          w.show();

          return a.exec();

          }

          I don't understand. What should it be there?

          If I change QApplication for QCoreApplication = QWidget: Cannot create a QWidget without QApplication

          Sorry I'm newbie using the QMySQL driver and libmysql.dll

          The problem is after deploying my desktop app.

          jsulmJ 1 Reply Last reply
          0
          • A AdrianN17

            @jsulm said in Deploy qt desktop app 'Driver not loaded':

            int main(int argc, char *argv[])
            {
            QApplication a(argc, argv); // <--- HERE
            login w;
            w.show();

            return a.exec();

            }

            I don't understand. What should it be there?

            If I change QApplication for QCoreApplication = QWidget: Cannot create a QWidget without QApplication

            Sorry I'm newbie using the QMySQL driver and libmysql.dll

            The problem is after deploying my desktop app.

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

            @AdrianN17 said in Deploy qt desktop app 'Driver not loaded':

            QApplication

            instead of QCoreApplication.

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

            A 1 Reply Last reply
            0
            • jsulmJ jsulm

              @AdrianN17 said in Deploy qt desktop app 'Driver not loaded':

              QApplication

              instead of QCoreApplication.

              A Offline
              A Offline
              AdrianN17
              wrote on last edited by
              #16

              @jsulm Ok thanks, but I was using QApplication from the beginning.

              jsulmJ 1 Reply Last reply
              0
              • A AdrianN17

                @jsulm Ok thanks, but I was using QApplication from the beginning.

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

                @AdrianN17 If you have "Cannot create a QWidget without QApplication" error with QApplication, then you're creating QWidget based class instance somewhere before QApplication instance is created. You need to check that. Do you have any static objects?

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

                A 1 Reply Last reply
                2
                • jsulmJ jsulm

                  @AdrianN17 If you have "Cannot create a QWidget without QApplication" error with QApplication, then you're creating QWidget based class instance somewhere before QApplication instance is created. You need to check that. Do you have any static objects?

                  A Offline
                  A Offline
                  AdrianN17
                  wrote on last edited by AdrianN17
                  #18

                  @jsulm I only was tested using a QCoreApplication instead QApplication :

                  @SGaist said in Deploy qt desktop app 'Driver not loaded':

                  The very first object you must create is a QCoreApplication (or QQuiApplication/QApplication) otherwise the required internals won't be initialised.

                  Because I have that problem when I deploy and execute my app:

                  QSqlDatabase: QMYSQL driver not loaded
                  QSqlDatabase: available drivers:
                  QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
                  "Driver not loaded Driver not loaded"

                  Because so far, I only had that error doing the test. The only problem really is with QMysql driver not loaded

                  Excuse me if I confused you

                  jsulmJ 1 Reply Last reply
                  0
                  • A AdrianN17

                    @jsulm I only was tested using a QCoreApplication instead QApplication :

                    @SGaist said in Deploy qt desktop app 'Driver not loaded':

                    The very first object you must create is a QCoreApplication (or QQuiApplication/QApplication) otherwise the required internals won't be initialised.

                    Because I have that problem when I deploy and execute my app:

                    QSqlDatabase: QMYSQL driver not loaded
                    QSqlDatabase: available drivers:
                    QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
                    "Driver not loaded Driver not loaded"

                    Because so far, I only had that error doing the test. The only problem really is with QMysql driver not loaded

                    Excuse me if I confused you

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

                    @AdrianN17 said in Deploy qt desktop app 'Driver not loaded':

                    I only was tested using a QCoreApplication instead QApplication

                    Again: if you're using widgets in your app you have to use QApplication.
                    And if you then have that error message then please check whether or not you're creating any QWidget based objects before QApplication or post whole code here, so we can check. Else I can't help you.

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

                    1 Reply Last reply
                    1
                    • A Offline
                      A Offline
                      AdrianN17
                      wrote on last edited by AdrianN17
                      #20

                      @jsulm

                      QMYSQL - libmysql.dll mysql-5.7.26-winx64 driver

                      .pro

                      # Default rules for deployment.
                      qnx: target.path = /tmp/$${TARGET}/bin
                      else: unix:!android: target.path = /opt/$${TARGET}/bin
                      !isEmpty(target.path): INSTALLS += target
                      
                      
                      
                      
                      
                      win32: LIBS += -LC:/Users/Adrian/Desktop/mysql-5.7.26-winx64/lib/ -llibmysql
                      
                      INCLUDEPATH += C:/Users/Adrian/Desktop/mysql-5.7.26-winx64/include
                      DEPENDPATH += C:/Users/Adrian/Desktop/mysql-5.7.26-winx64/include
                      

                      QT DEBUG PLUGINS

                      01:57:42: Starting D:\Proyectos\Proyecto_Restaurante_Qt\build-restaurante_tunqui-Desktop_Qt_5_12_3_MSVC2017_64bit-Debug\debug\restaurante_tunqui.exe ...
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers" ...
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlite.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlite.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QSQLITE"
                              ]
                          },
                          "archreq": 0,
                          "className": "QSQLiteDriverPlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlite.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlited.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlited.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QSQLITE"
                              ]
                          },
                          "archreq": 1,
                          "className": "QSQLiteDriverPlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("QSQLITE")
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlmysql.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QMYSQL3",
                                  "QMYSQL"
                              ]
                          },
                          "archreq": 0,
                          "className": "QMYSQLDriverPlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlmysql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlmysqld.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlmysqld.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QMYSQL3",
                                  "QMYSQL"
                              ]
                          },
                          "archreq": 1,
                          "className": "QMYSQLDriverPlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlodbc.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QODBC3",
                                  "QODBC"
                              ]
                          },
                          "archreq": 0,
                          "className": "QODBCDriverPlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlodbc.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlodbcd.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlodbcd.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QODBC3",
                                  "QODBC"
                              ]
                          },
                          "archreq": 1,
                          "className": "QODBCDriverPlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("QODBC3", "QODBC")
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlpsql.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QPSQL7",
                                  "QPSQL"
                              ]
                          },
                          "archreq": 0,
                          "className": "QPSQLDriverPlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlpsql.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlpsqld.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QPSQL7",
                                  "QPSQL"
                              ]
                          },
                          "archreq": 1,
                          "className": "QPSQLDriverPlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("QPSQL7", "QPSQL")
                      loaded library "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlmysqld.dll"
                      true
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms" ...
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qdirect2d.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qdirect2d.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "direct2d"
                              ]
                          },
                          "archreq": 0,
                          "className": "QWindowsDirect2DIntegrationPlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qdirect2d.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qdirect2dd.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qdirect2dd.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "direct2d"
                              ]
                          },
                          "archreq": 1,
                          "className": "QWindowsDirect2DIntegrationPlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("direct2d")
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qminimal.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qminimal.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "minimal"
                              ]
                          },
                          "archreq": 0,
                          "className": "QMinimalIntegrationPlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qminimal.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qminimald.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qminimald.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "minimal"
                              ]
                          },
                          "archreq": 1,
                          "className": "QMinimalIntegrationPlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("minimal")
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qoffscreen.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qoffscreen.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "offscreen"
                              ]
                          },
                          "archreq": 0,
                          "className": "QOffscreenIntegrationPlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qoffscreen.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qoffscreend.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qoffscreend.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "offscreen"
                              ]
                          },
                          "archreq": 1,
                          "className": "QOffscreenIntegrationPlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("offscreen")
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwebgl.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwebgl.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "webgl"
                              ]
                          },
                          "archreq": 0,
                          "className": "QWebGLIntegrationPlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwebgl.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwebgld.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwebgld.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "webgl"
                              ]
                          },
                          "archreq": 1,
                          "className": "QWebGLIntegrationPlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("webgl")
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwindows.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwindows.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "windows"
                              ]
                          },
                          "archreq": 0,
                          "className": "QWindowsIntegrationPlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwindows.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwindowsd.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwindowsd.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "windows"
                              ]
                          },
                          "archreq": 1,
                          "className": "QWindowsIntegrationPlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("windows")
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Proyectos/Proyecto_Restaurante_Qt/build-restaurante_tunqui-Desktop_Qt_5_12_3_MSVC2017_64bit-Debug/debug/platforms" ...
                      loaded library "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwindowsd.dll"
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platformthemes" ...
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platformthemes/qxdgdesktopportal.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platformthemes/qxdgdesktopportal.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
                          "MetaData": {
                              "Keys": [
                                  "xdgdesktopportal",
                                  "flatpak",
                                  "snap"
                              ]
                          },
                          "archreq": 0,
                          "className": "QXdgDesktopPortalThemePlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/platformthemes/qxdgdesktopportal.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platformthemes/qxdgdesktopportald.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/platformthemes/qxdgdesktopportald.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
                          "MetaData": {
                              "Keys": [
                                  "xdgdesktopportal",
                                  "flatpak",
                                  "snap"
                              ]
                          },
                          "archreq": 1,
                          "className": "QXdgDesktopPortalThemePlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("xdgdesktopportal", "flatpak", "snap")
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Proyectos/Proyecto_Restaurante_Qt/build-restaurante_tunqui-Desktop_Qt_5_12_3_MSVC2017_64bit-Debug/debug/platformthemes" ...
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Programas/QT/5.12.3/msvc2017_64/plugins/styles" ...
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/styles/qwindowsvistastyle.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/styles/qwindowsvistastyle.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QStyleFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "windowsvista"
                              ]
                          },
                          "archreq": 0,
                          "className": "QWindowsVistaStylePlugin",
                          "debug": false,
                          "version": 330752
                      }
                      
                      
                      "The plugin 'D:/Programas/QT/5.12.3/msvc2017_64/plugins/styles/qwindowsvistastyle.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "D:/Programas/QT/5.12.3/msvc2017_64/plugins/styles/qwindowsvistastyled.dll"
                      Found metadata in lib D:/Programas/QT/5.12.3/msvc2017_64/plugins/styles/qwindowsvistastyled.dll, metadata=
                      {
                          "IID": "org.qt-project.Qt.QStyleFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "windowsvista"
                              ]
                          },
                          "archreq": 1,
                          "className": "QWindowsVistaStylePlugin",
                          "debug": true,
                          "version": 330752
                      }
                      
                      
                      Got keys from plugin meta data ("windowsvista")
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Proyectos/Proyecto_Restaurante_Qt/build-restaurante_tunqui-Desktop_Qt_5_12_3_MSVC2017_64bit-Debug/debug/styles" ...
                      loaded library "D:/Programas/QT/5.12.3/msvc2017_64/plugins/styles/qwindowsvistastyled.dll"
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Programas/QT/5.12.3/msvc2017_64/plugins/accessible" ...
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Proyectos/Proyecto_Restaurante_Qt/build-restaurante_tunqui-Desktop_Qt_5_12_3_MSVC2017_64bit-Debug/debug/accessible" ...
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Programas/QT/5.12.3/msvc2017_64/plugins/accessiblebridge" ...
                      QFactoryLoader::QFactoryLoader() checking directory path "D:/Proyectos/Proyecto_Restaurante_Qt/build-restaurante_tunqui-Desktop_Qt_5_12_3_MSVC2017_64bit-Debug/debug/accessiblebridge" ...
                      QLibraryPrivate::unload succeeded on "D:/Programas/QT/5.12.3/msvc2017_64/plugins/sqldrivers/qsqlmysqld.dll" 
                      QLibraryPrivate::unload succeeded on "D:/Programas/QT/5.12.3/msvc2017_64/plugins/styles/qwindowsvistastyled.dll" 
                      QLibraryPrivate::unload succeeded on "D:/Programas/QT/5.12.3/msvc2017_64/plugins/platforms/qwindowsd.dll"
                      

                      After deploy

                      alt text
                      alt text
                      *Profile and Release have the same result

                      Before deploy
                      alt text
                      alt text

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        AdrianN17
                        wrote on last edited by AdrianN17
                        #21

                        Change my odbc conection

                        QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
                            db.setDatabaseName("Driver={MySQL ODBC 8.0 ANSI Driver};Server=localhost;DATABASE=tunqui_restaurante;");
                            db.setUserName("root");
                            db.setPassword("");
                        

                        and my query

                        //if (query.size()>0) comment this line
                            {
                         while(query.next())
                                {
                                    us.set_ID_usuario(query.value("ID_usuario").toInt());
                                    us.set_nombre(query.value("nombre").toString());
                                    us.set_apellido(query.value("apellido").toString());
                                    us.set_dni(query.value("dni").toString());
                                    us.set_telefono(query.value("telefono").toString());
                                    us.set_correo(query.value("correo").toString());
                                    us.set_cargo(query.value("cargo").toInt());
                                    us.set_direccion(query.value("direccion").toString());
                        
                                }
                        //}
                        

                        ODBC conection work fine and I can log in my app (error code fixed)

                        But when I deploy with windeployqt I had the same problem with QMYSQL

                        windeployqt command : windeployqt restaurante_tunqui.exe

                        alt text

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          AdrianN17
                          wrote on last edited by AdrianN17
                          #22

                          I found the solution:

                              
                          #include "controlador.h"
                          #include "qmessagebox.h"
                          
                          controlador::controlador()
                          {
                          
                          }
                          
                          static QSqlDatabase con=conexion().conecta();
                          

                          to

                          usuario controlador::logear(acceso ac)
                          {
                              usuario us= usuario();
                          
                              QSqlDatabase con=conexion().conecta();
                          
                              QSqlQuery query(con);
                          
                          #include "vistas/login.h"
                          #include <QApplication>
                          
                          int main(int argc, char *argv[])
                          {
                              QApplication::libraryPaths();
                              QApplication a(argc, argv);
                              login w;
                              w.show();
                          
                              return a.exec();
                          }
                          

                          https://forum.qt.io/topic/66480/deploy-on-windows/14

                          I think because static db conection, windeployqt work fine

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

                            There's really no need for any static (nor class variable) QDatabase object. QDatabase already provide all methods needed to create and retrieve database connection when needed.

                            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
                            3
                            • A Offline
                              A Offline
                              AdrianN17
                              wrote on last edited by AdrianN17
                              #24

                              Sure. It was a mistake using static QSqlDatabase object, because only fail at the deployment.

                              Thanks guys.

                              1 Reply Last reply
                              1

                              • Login

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