Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt error: undefined reference to `qt_static_plugin_QMYSQLDriverPlugin()'

Qt error: undefined reference to `qt_static_plugin_QMYSQLDriverPlugin()'

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 4.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sasha
    wrote on last edited by
    #1

    Hi i was compile static version of QT with -qt-sql-mysql, but when i try to compile program i got error
    error: undefined reference to `qt_static_plugin_QMYSQLDriverPlugin()'
    Can u help me with this?
    Thanks a lot

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

      Hi and welcome to devnet,

      Did you import the plugin when building your application ?

      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
      • S Offline
        S Offline
        Sasha
        wrote on last edited by Sasha
        #3

        Hi, thanks for welcome and quick replay.
        Do u mean on Q_IMPORT_PLUGIN(qsqlmysql)?
        I was try that but i dont have a lucky.
        I got this file while i trying to compile
        // This file is autogenerated by qmake. It imports static plugin classes for
        // static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables.
        #include <QtPlugin>
        Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
        Q_IMPORT_PLUGIN(QICOPlugin)
        Q_IMPORT_PLUGIN(QGenericEnginePlugin)
        Q_IMPORT_PLUGIN(QNativeWifiEnginePlugin)
        Q_IMPORT_PLUGIN(QMYSQLDriverPlugin)

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sasha
          wrote on last edited by
          #4

          Does anyone is statically compiled application with mysql support. I was try to compile qt with
          configure -static -opengl desktop -opensource -release -qt-sql-mysql -I "mysql_include_location" -L "LIBS"
          configure -static -opengl desktop -opensource -release -plugin-sql-mysql -I "mysql_include_location" -L "LIBS"
          mingw32-make sub-src;
          After that i was compile mysql drivers:
          qtbase\src\plugin\sqldrivers\mysql> qmake "INCLUDEPATH+=include location" "LIBS+=libs location` mysql.pro

          And what ever i do i have problems, i cant static compile with mysql.....
          5 days i read all tutorials and still i cant find sulution.
          Thanks for any help....
          Aleksandar.

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

            Since you are compiling Qt statically anyway, you should rather also get the sql plugins built in rather than as a plugin. That will avoid your current problem.

            configure -static -opengl desktop -opensource -release -qt-sql-mysql -I "mysql_include_location" -L "mysql_lib_location"

            would be more accurate

            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
            • S Offline
              S Offline
              Sasha
              wrote on last edited by
              #6

              @SGaist said:

              Since you are compiling Qt statically anyway, you should rather also get the sql plugins built in rather than as a plugin. That will avoid your current problem.

              configure -static -opengl desktop -opensource -release -qt-sql-mysql -I "mysql_include_location" -L "mysql_lib_location" is configure that i use when i compile qt for static building.
              After this command i run mingw32-make sub-src.

              With this qt i can create aplication statically but i cant use mysql. Allways i got error error: undefined reference to `qt_static_plugin_QMYSQLDriverPlugin()' when i try to use mysql.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Sasha
                wrote on last edited by
                #7

                I solve problem. When i delete qt opensource install dir and install it again, i was configure and compile static version of qt with -qt-sql-mysql then all work fine.
                Thanks a lot for trying to help me.
                Best regards.

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

                  Since you have it running now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

                  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