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. Error when use mysql library
Forum Updated to NodeBB v4.3 + New Features

Error when use mysql library

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 2.5k 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.
  • I Offline
    I Offline
    illunara
    wrote on last edited by illunara
    #1

    Hi everybody
    I got error when compile project with mysql
    C:\Users\illunara\Documents\gui\main.cpp:-1: error: undefined reference to `qt_static_plugin_qsqlmysql()'

    I'm had
    win7 ultimate x64
    build Qt 5.4.2 mingw491 static
    build sqldriver for qt and copy it into QtStatic\plugin\sqldrivers
    copy libmysqll.dll to windows's folder

    And here is my .pro file

    TEMPLATE = app

    QT += qml quick sql network xml

    QMAKE_CXXFLAGS += -std=c++0x

    RC_FILE = gui.rc

    RESOURCES += qml.qrc

    CONFIG += static plugin

    QML_IMPORT_PATH =

    include(deployment.pri)

    It works fine with dynamic Qt through. Was i missing something? Thanks

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

      Hi and welcome to devnet,

      You can find more information about static plugin handling here

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

      I 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        You can find more information about static plugin handling here

        I Offline
        I Offline
        illunara
        wrote on last edited by illunara
        #3

        @SGaist Thank for a warm-heart welcoming
        Since i still new to QT, can you give me more detail please?
        I look into Plug & Paint example as you suggest
        LIBS = -Lplugins -lpnp_basictools
        What does this command do, and where can i read about its syntax?

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

          I was pointing the part containing

          QTPLUGIN     += qjpeg \
                          qgif \
                          qkrcodecs
          

          That, you have to add QTPLUGIN in your pro file with the plugins your application uses.

          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
          • I Offline
            I Offline
            illunara
            wrote on last edited by illunara
            #5

            Thank for your reply
            I tried to follow the example and add those line to pro
            CONFIG += static console
            QTPLUGIN += qsqlmysql

            Also
            Q_IMPORT_PLUGIN(qsqlmysql)
            in main.cpp

            The compiler keep telling me that
            "Plugin class name could not be determined for qsqlmysql plugin."
            I compiled mysql plugin and put qsqlmysql.dll, qsqlmysqld.dll into qt static plugin folder
            C:\Qt\Static\5.4.2\plugins\sqldrivers

            It works well on non-static QT through :(

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

              Since you are building Qt yourself anyway, the simplest thing to do with the SQL plugins is to use the "built-in" Qt option so they are directly in.

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

              I 1 Reply Last reply
              0
              • SGaistS SGaist

                Since you are building Qt yourself anyway, the simplest thing to do with the SQL plugins is to use the "built-in" Qt option so they are directly in.

                I Offline
                I Offline
                illunara
                wrote on last edited by
                #7

                @SGaist I found this on the windows-build-qt-static script

                configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -no-openssl
                -opensource -confirm-license `
                -make libs -nomake tools -nomake examples -nomake tests

                Should i add -qt-sql-mysql flag?

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

                  Yes, however, don't forget the licensing implication of a static build.

                  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