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. How to build mysql plugin with static Qt?
QtWS25 Last Chance

How to build mysql plugin with static Qt?

Scheduled Pinned Locked Moved Installation and Deployment
7 Posts 4 Posters 5.5k 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.
  • A Offline
    A Offline
    alexxx_1992
    wrote on last edited by
    #1

    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
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Did you remember to add QTPLUGIN to your .pro?

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexxx_1992
        wrote on last edited by
        #3

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

        Student

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          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
          0
          • A Offline
            A Offline
            alexxx_1992
            wrote on last edited by
            #5

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

            Student

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              [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
              0
              • T Offline
                T Offline
                Theo Dev
                wrote on last edited by
                #7

                You must import the plugin with

                Q_IMPORT_PLUGIN(QMYSQLDriverPlugin)
                
                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