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. Issues connecting QT to MYSQL
Forum Updated to NodeBB v4.3 + New Features

Issues connecting QT to MYSQL

Scheduled Pinned Locked Moved Solved Installation and Deployment
15 Posts 5 Posters 1.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.
  • R Richard1973

    Ubuntu 20.04
    QT 5.15.2
    MySql 8.0.22

    I am having issues connecting QT to MySQL. I have tried to look up several threads on this issue, but still cannot find any solution. I put the debug error at the end of this post. Several things I noticed when following other thread solutions:
    ldd libqsqlmysql.so results: ldd: ./libqsqlmysql.so: No such file or directory
    I just dont have it in my Qt/5.15.2/gcc_64/plugins/sqldriver. I downloaded everything for QT 5.15.2 and Developer and Designer Tools.

    When I try to follow the instructions on https://doc.qt.io/qt-5/sql-driver.html#qmysql, I would get mixed errors with qmake. My lastest one looks like this:

    luden@luden-desktop:~/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers$ qmake -- MYSQL_PREFIX=/var/lib

    Running configuration tests...
    Checking for DB2 (IBM)... no
    Checking for InterBase... no
    Checking for MySQL... yes
    Checking for OCI (Oracle)... no
    Project ERROR: Unknown feature object datestring in expression 'features.datestring && libs.odbc'.

    I cant find anything on this Project ERROR. Any help would be appreciated. Thank you.

    Debug Error:
    QFactoryLoader::QFactoryLoader() checking directory path "/home/luden/Qt/5.15.2/gcc_64/plugins/sqldrivers" ...
    QFactoryLoader::QFactoryLoader() looking at "/home/luden/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so"
    Found metadata in lib /home/luden/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QSQLITE"
    ]
    },
    "archreq": 0,
    "className": "QSQLiteDriverPlugin",
    "debug": false,
    "version": 331520
    }

    Got keys from plugin meta data ("QSQLITE")
    QFactoryLoader::QFactoryLoader() looking at "/home/luden/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlite.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/luden/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so"
    Found metadata in lib /home/luden/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QODBC3",
    "QODBC"
    ]
    },
    "archreq": 0,
    "className": "QODBCDriverPlugin",
    "debug": false,
    "version": 331520
    }

    Got keys from plugin meta data ("QODBC3", "QODBC")
    QFactoryLoader::QFactoryLoader() looking at "/home/luden/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlodbc.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/home/luden/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so"
    Found metadata in lib /home/luden/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QPSQL7",
    "QPSQL"
    ]
    },
    "archreq": 0,
    "className": "QPSQLDriverPlugin",
    "debug": false,
    "version": 331520
    }

    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    QFactoryLoader::QFactoryLoader() looking at "/home/luden/Qt/5.15.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so.debug"
    "The shared library was not found."
    not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "/home/luden/Documents/QT Projects/build-QTMYSQLConnection-Desktop_Qt_5_15_0_GCC_64bit-Debug/sqldrivers" ...
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/xcbglintegrations/libqxcb-glx-integration.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/imageformats/libqgif.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/imageformats/libqicns.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/imageformats/libqico.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/imageformats/libqjpeg.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/imageformats/libqsvg.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/imageformats/libqtga.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/imageformats/libqtiff.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/imageformats/libqwbmp.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/imageformats/libqwebp.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/platformthemes/libqgtk3.so"
    QLibraryPrivate::unload succeeded on "/home/luden/Qt/5.15.2/gcc_64/plugins/platforms/libqxcb.so"
    QLibraryPrivate::unload succeeded on "Xcursor" (faked)

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

    @Richard1973 said in Issues connecting QT to MYSQL:

    qmake -- MYSQL_PREFIX=/var/lib

    Are you sure you are calling qmake from your Qt installation and not what was preinstalled from your Linux distribution?
    Use absolute path to qmake to make sure you're using correct qmake.

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

    1 Reply Last reply
    1
    • R Offline
      R Offline
      Richard1973
      wrote on last edited by
      #3

      @jsulm Thank you for that reply. I managed to get qmake working after installing the qt5-default. Now I am having problems running make sub-mysql. The first error fatal error: QtSql/private/qsqldriver_p.h which I managed to solve by installing the qt5-private-dev.

      Now I am getting a new error:
      luden@luden-desktop:~/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers$ make sub-mysql
      cd mysql/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /home/luden/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/mysql/mysql.pro MYSQL_PREFIX=/var/lib ) && make -f Makefile
      make[1]: Entering directory '/home/luden/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/mysql'
      g++ -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -Wno-deprecated-copy -Wno-redundant-move -Wno-format-overflow -Wno-init-list-lifetime -D_REENTRANT -fPIC -DQT_NO_JAVA_STYLE_ITERATORS -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.12.8 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.12.8/QtCore -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I.moc -isystem /usr/include/mysql -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
      qsql_mysql.cpp: In constructor ‘QMYSQLDriverPrivate::QMYSQLDriverPrivate()’:
      qsql_mysql.cpp:83:42: error: no matching function for call to ‘QSqlDriverPrivate::QSqlDriverPrivate(QSqlDriver::DbmsType)’
      83 | , tc(QTextCodec::codecForLocale())
      | ^
      In file included from qsql_mysql.cpp:57:
      /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:66:5: note: candidate: ‘QSqlDriverPrivate::QSqlDriverPrivate()’
      66 | QSqlDriverPrivate()
      | ^~~~~~~~~~~~~~~~~
      /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:66:5: note: candidate expects 0 arguments, 1 provided
      /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: candidate: ‘QSqlDriverPrivate::QSqlDriverPrivate(const QSqlDriverPrivate&)’
      61 | class QSqlDriverPrivate : public QObjectPrivate
      | ^~~~~~~~~~~~~~~~~
      /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: no known conversion for argument 1 from ‘QSqlDriver::DbmsType’ to ‘const QSqlDriverPrivate&’
      /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: candidate: ‘QSqlDriverPrivate::QSqlDriverPrivate(QSqlDriverPrivate&&)’
      /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: no known conversion for argument 1 from ‘QSqlDriver::DbmsType’ to ‘QSqlDriverPrivate&&’
      qsql_mysql.cpp: In member function ‘virtual bool QMYSQLDriver::open(const QString&, const QString&, const QString&, const QString&, int, const QString&)’:
      qsql_mysql.cpp:1243:65: error: ‘SkipEmptyParts’ is not a member of ‘Qt’
      1243 | const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
      | ^~~~~~~~~~~~~~

      make[1]: *** [Makefile:384: .obj/qsql_mysql.o] Error 1
      make[1]: Leaving directory '/home/luden/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/mysql'
      make: *** [Makefile:45: sub-mysql] Error 2

      I read somewhere about using QT_VERSION_CHECK (https://github.com/MaartenBaert/ssr/issues/809), but I am not sure if that will help me nor do I know how to use it.

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

        You're still mixing up your Qt installations. QSqlDriverPrivate(QSqlDriver::DbmsType) was added in 5.15 and replaced QSqlDriverPrivate()

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

        1 Reply Last reply
        2
        • R Offline
          R Offline
          Richard1973
          wrote on last edited by
          #5

          @Christian-Ehrlicher So how do I fixed this?

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

            Hi,

            As @jsulm already wrote: use the full path to the qmake executable from your Qt 5.15 installation.

            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
            • R Offline
              R Offline
              Richard1973
              wrote on last edited by
              #7

              @SGaist So I tried to make a path to the qt qmake, but I have no idea how since I am still new to ubuntu. For what its worth, when I type qmake -version, I get both the linux version 5.12.8 and the qt version 3.1. I tried using chmod but I am getting a permission error. Besides, I am not sure I am doing what you are explaining. Can you please tell me how to do this?

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

                In the console, type the full path to where you have the qmake executable.

                Something like:

                /home/username/Qt/5.15.2/gcc_64/bin/qmake
                

                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
                • R Offline
                  R Offline
                  Richard1973
                  wrote on last edited by
                  #9

                  @SGaist So i typed:
                  /home/luden/Qt/5.15.2/gcc_64/bin/qmake -- MYSQL_PREFIX=/usr/local
                  and it detected the MySql has a yes. However, when I type make sub-mysql, I get what looks like the same error as above:

                  make sub-mysql
                  cd mysql/ && ( test -e Makefile || /home/luden/Qt/5.15.2/gcc_64/bin/qmake -o Makefile /home/luden/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/mysql/mysql.pro ) && make -f Makefile
                  make[1]: Entering directory '/home/luden/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/mysql'
                  g++ -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -Wno-deprecated-copy -Wno-redundant-move -Wno-format-overflow -Wno-init-list-lifetime -D_REENTRANT -fPIC -DQT_NO_JAVA_STYLE_ITERATORS -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.12.8 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.12.8/QtCore -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I.moc -isystem /usr/include/mysql -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
                  qsql_mysql.cpp: In constructor ‘QMYSQLDriverPrivate::QMYSQLDriverPrivate()’:
                  qsql_mysql.cpp:83:42: error: no matching function for call to ‘QSqlDriverPrivate::QSqlDriverPrivate(QSqlDriver::DbmsType)’
                  83 | , tc(QTextCodec::codecForLocale())
                  | ^
                  In file included from qsql_mysql.cpp:57:
                  /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:66:5: note: candidate: ‘QSqlDriverPrivate::QSqlDriverPrivate()’
                  66 | QSqlDriverPrivate()
                  | ^~~~~~~~~~~~~~~~~
                  /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:66:5: note: candidate expects 0 arguments, 1 provided
                  /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: candidate: ‘QSqlDriverPrivate::QSqlDriverPrivate(const QSqlDriverPrivate&)’
                  61 | class QSqlDriverPrivate : public QObjectPrivate
                  | ^~~~~~~~~~~~~~~~~
                  /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: no known conversion for argument 1 from ‘QSqlDriver::DbmsType’ to ‘const QSqlDriverPrivate&’
                  /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: candidate: ‘QSqlDriverPrivate::QSqlDriverPrivate(QSqlDriverPrivate&&)’
                  /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: no known conversion for argument 1 from ‘QSqlDriver::DbmsType’ to ‘QSqlDriverPrivate&&’
                  qsql_mysql.cpp: In member function ‘virtual bool QMYSQLDriver::open(const QString&, const QString&, const QString&, const QString&, int, const QString&)’:
                  qsql_mysql.cpp:1243:65: error: ‘SkipEmptyParts’ is not a member of ‘Qt’
                  1243 | const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
                  | ^~~~~~~~~~~~~~

                  make[1]: *** [Makefile:384: .obj/qsql_mysql.o] Error 1
                  make[1]: Leaving directory '/home/luden/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/mysql'
                  make: *** [Makefile:45: sub-mysql] Error 2

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

                    Cleanup the sources as explained in the documentation and restart the procedure.

                    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
                    • R Offline
                      R Offline
                      Richard1973
                      wrote on last edited by
                      #11

                      @SGaist I have tried to uninstall and reinstall the src from the qt maintenance. But I still get the same error. I tried looking up "cleanup sources" on the qt documentation website and got nothing. Do you have the documentation link that explains this procedure?

                      1 Reply Last reply
                      0
                      • hskoglundH Offline
                        hskoglundH Offline
                        hskoglund
                        wrote on last edited by
                        #12

                        Hi, it's more difficult when you have 2 different versions of Qt installed in the same Ubuntu system, that's why you get this error:
                        qsql_mysql.cpp:83:42: error: no matching function for call to ‘QSqlDriverPrivate::QSqlDriverPrivate(QSqlDriver::DbmsType)’

                        The 2 different Qt versions are fighting each other (as @Christian-Ehrlicher said above: SqlDriverPrivate(QSqlDriver::DbmsType) was added in 5.15 and replaced QSqlDriverPrivate)

                        Maybe you could try uninstalling of the 2 Qts...

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

                          Look at the note under Building The Drivers.

                          Also, consider using out of source builds, that will makes things simpler to clean on error/retry.

                          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
                          • R Richard1973

                            @jsulm Thank you for that reply. I managed to get qmake working after installing the qt5-default. Now I am having problems running make sub-mysql. The first error fatal error: QtSql/private/qsqldriver_p.h which I managed to solve by installing the qt5-private-dev.

                            Now I am getting a new error:
                            luden@luden-desktop:~/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers$ make sub-mysql
                            cd mysql/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /home/luden/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/mysql/mysql.pro MYSQL_PREFIX=/var/lib ) && make -f Makefile
                            make[1]: Entering directory '/home/luden/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/mysql'
                            g++ -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -Wno-deprecated-copy -Wno-redundant-move -Wno-format-overflow -Wno-init-list-lifetime -D_REENTRANT -fPIC -DQT_NO_JAVA_STYLE_ITERATORS -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.12.8 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.12.8/QtCore -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSql -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I.moc -isystem /usr/include/mysql -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
                            qsql_mysql.cpp: In constructor ‘QMYSQLDriverPrivate::QMYSQLDriverPrivate()’:
                            qsql_mysql.cpp:83:42: error: no matching function for call to ‘QSqlDriverPrivate::QSqlDriverPrivate(QSqlDriver::DbmsType)’
                            83 | , tc(QTextCodec::codecForLocale())
                            | ^
                            In file included from qsql_mysql.cpp:57:
                            /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:66:5: note: candidate: ‘QSqlDriverPrivate::QSqlDriverPrivate()’
                            66 | QSqlDriverPrivate()
                            | ^~~~~~~~~~~~~~~~~
                            /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:66:5: note: candidate expects 0 arguments, 1 provided
                            /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: candidate: ‘QSqlDriverPrivate::QSqlDriverPrivate(const QSqlDriverPrivate&)’
                            61 | class QSqlDriverPrivate : public QObjectPrivate
                            | ^~~~~~~~~~~~~~~~~
                            /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: no known conversion for argument 1 from ‘QSqlDriver::DbmsType’ to ‘const QSqlDriverPrivate&’
                            /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: candidate: ‘QSqlDriverPrivate::QSqlDriverPrivate(QSqlDriverPrivate&&)’
                            /usr/include/x86_64-linux-gnu/qt5/QtSql/5.12.8/QtSql/private/qsqldriver_p.h:61:7: note: no known conversion for argument 1 from ‘QSqlDriver::DbmsType’ to ‘QSqlDriverPrivate&&’
                            qsql_mysql.cpp: In member function ‘virtual bool QMYSQLDriver::open(const QString&, const QString&, const QString&, const QString&, int, const QString&)’:
                            qsql_mysql.cpp:1243:65: error: ‘SkipEmptyParts’ is not a member of ‘Qt’
                            1243 | const QStringList opts(connOpts.split(QLatin1Char(';'), Qt::SkipEmptyParts));
                            | ^~~~~~~~~~~~~~

                            make[1]: *** [Makefile:384: .obj/qsql_mysql.o] Error 1
                            make[1]: Leaving directory '/home/luden/Qt/5.15.2/Src/qtbase/src/plugins/sqldrivers/mysql'
                            make: *** [Makefile:45: sub-mysql] Error 2

                            I read somewhere about using QT_VERSION_CHECK (https://github.com/MaartenBaert/ssr/issues/809), but I am not sure if that will help me nor do I know how to use it.

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

                            @Richard1973 said in Issues connecting QT to MYSQL:

                            I managed to get qmake working after installing the qt5-default

                            No, you did not. Instead of simply using absolute path to qmake you installed a different Qt version...

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

                            1 Reply Last reply
                            0
                            • R Offline
                              R Offline
                              Richard1973
                              wrote on last edited by
                              #15

                              So I uninstalled qt5-deafult using sudo apt-remove. When i tried to do the same for the private-dev it just says that it cant find the package. I used maintenance tool to remove everything. For good measures I restarted my computer. I then used run, installed everything for 5.15.2 and for teh developer and creator install the default cmake and ninja.
                              I then created a new project to connect mysql and qt. Followed the instructions from teh sql-driver. The qmake did not come back with an error and make sub-mysql seems to have worked as well. When I went to reconnect, I still got the same Debug Error as above. But after using make install, everything seems to work now. Even managed to connect and extract information from mysql. So thank you everyone who has helped me.

                              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