Qt error: undefined reference to `qt_static_plugin_QMYSQLDriverPlugin()'



  • 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


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you import the plugin when building your application ?



  • 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)



  • 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.


  • Lifetime Qt Champion

    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



  • @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.



  • 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.


  • Lifetime Qt Champion

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.