Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How to build mysql plugin with static Qt?

    Installation and Deployment
    4
    7
    5055
    Loading More Posts
    • 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.
    • A
      alexxx_1992 last edited by

      I have libraries bulit both static and shared. In shared library I built mysql plugin and it works good. In static library I did the same actions to build plugin and plugin was bulit, but when I want to use it QSqlDatabase::lastError shows "Driver not loaded" and if I use it by #include <QtPlugin>, Q_IMPORT_PLUGIN (qsqlmysql) there is error: main.obj : error LNK2019: unresolved external symbol "class QObject * __cdecl qt_plugin_instance_qsqlmysql(void)" (?qt_plugin_instance_qsqlmysql@@YAPAVQObject@@XZ) referenced in function "public: __thiscall StaticqsqlmysqlPluginInstance::StaticqsqlmysqlPluginInstance(void)" (??0StaticqsqlmysqlPluginInstance@@QAE@XZ). Anybody can helps me?
      Qt 4.7.4 + VS 2010

      Student

      1 Reply Last reply Reply Quote 0
      • D
        dangelog last edited by

        Did you remember to add QTPLUGIN to your .pro?

        Software Engineer
        KDAB (UK) Ltd., a KDAB Group company

        1 Reply Last reply Reply Quote 0
        • A
          alexxx_1992 last edited by

          no, I didn't add, how I can do this from VS?

          Student

          1 Reply Last reply Reply Quote 0
          • K
            koahnig last edited by

            Isn't there a contradiction of PlugIn and static linking?
            "Here":http://developer.qt.nokia.com/doc/qt-4.8/qpluginloader.html#id-cad524e7-589d-42ca-ab1b-3a493da9284b loading at run-time. In a static build you do not load at runtime anymore IMHO.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply Reply Quote 0
            • A
              alexxx_1992 last edited by

              I solved the problem by coping libmysql.lib to qt\lib and adding to linker input.

              Student

              1 Reply Last reply Reply Quote 0
              • K
                koahnig last edited by

                [quote author="alexxx_1992" date="1324399804"]I solved the problem by coping libmysql.lib to qt\lib and adding to linker input.[/quote]

                Why did you add an additional directory to "Additional Library Directories" under "Linker" of your project properties?
                This is as you have to do in msvc 2005. I guess the naming did not much for msvc 2010.

                Vote the answer(s) that helped you to solve your issue(s)

                1 Reply Last reply Reply Quote 0
                • T
                  Theo Dev last edited by

                  You must import the plugin with

                  Q_IMPORT_PLUGIN(QMYSQLDriverPlugin)
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post