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. Plugin system - DLLs and unresolved external symbols
QtWS25 Last Chance

Plugin system - DLLs and unresolved external symbols

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 4.7k 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.
  • P Offline
    P Offline
    Peppy
    wrote on last edited by
    #1

    Hi guys, I have one (big) issue creating plug-n-play system of plugins, which my app deserves...the issue is that application is missing
    external symbols, I was following step-by-step Plug-n-paint example, but I have discovered, it's a static linking. I want to create plugins via dynamic linking, is it possible, or not?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      Of course. Plugins are dynamically linked by default.

      Please post your .pro files as well the linker error.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Peppy
        wrote on last edited by
        #3

        Here is it: App.pro:
        @
        QT += core gui network

        TARGET = App
        TEMPLATE = app

        SOURCES += main.cpp
        SingleApplication.cpp

        HEADERS +=
        SingleApplication.h
        @

        Linker says that:
        @
        core.obj:-1: error: LNK2001: unresolved external symbol "public: static struct QMetaObject const Core::staticMetaObject" (?staticMetaObject@Core@@2UQMetaObject@@B)
        core.obj:-1: error: LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Core::metaObject(void)const " (?metaObject@Core@@UBEPBUQMetaObject@@XZ)
        core.obj:-1: error: LNK2001: unresolved external symbol "public: virtual void * __thiscall Core::qt_metacast(char const *)" (?qt_metacast@Core@@UAEPAXPBD@Z)
        core.obj:-1: error: LNK2001: unresolved external symbol "public: virtual int __thiscall Core::qt_metacall(enum QMetaObject::Call,int,void * *)"
        core.obj:-1: error: LNK2001: unresolved external symbol "public: virtual void __thiscall interface::hello(void)" (?hello@interface@@UAEXXZ)(?qt_metacall@Core@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
        ........\App\bin\debug\App.Core.dll:-1: error: LNK1120: 5 unresolved externals
        @

        And library project file:
        @
        TARGET = App.Core
        TEMPLATE = lib

        CONFIG += plugin

        DEFINES += CORE_LIBRARY

        SOURCES += core.cpp

        HEADERS += core.h
        Core_global.h
        interface.h

        symbian {
        MMP_RULES += EXPORTUNFROZEN
        TARGET.UID3 = 0xE2EB6093
        TARGET.CAPABILITY =
        TARGET.EPOCALLOWDLLDATA = 1
        addFiles.sources = Core.dll
        addFiles.path = !:/sys/bin
        DEPLOYMENT += addFiles
        }

        unix:!symbian {
        maemo5 {
        target.path = /opt/usr/lib
        } else {
        target.path = /usr/lib
        }
        INSTALLS += target
        }

        @

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Peppy
          wrote on last edited by
          #4

          hey guys, c'mon! :)...

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sam
            wrote on last edited by
            #5

            Hi,

            Dont know whether this will help or not, but you can have a look in this "tutorial":http://www.voidrealms.com/viewtutorial.aspx?id=246 that explains about how to create and load plugins.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              chernetsov0
              wrote on last edited by
              #6

              Without
              @CONFIG += plugin@

              you need to write such a structure before the class (or place it into header and include it if you export more than one class)

              @#ifndef CORE_LIBRARY
              #define APP_CORE_EXPORTS Q_DECL_IMPORT
              #else
              #define APP_CORE_EXPORTS Q_DECL_EXPORT
              #endif@

              and declare classes like this
              @
              class APP_CORE_EXPORTS AppCore@

              [quote author="Peppy" date="1346020550"] I want to create plugins via dynamic linking, is it possible, or not?[/quote]

              Qt plugins are dynamically loaded from their .dll/.so files by QPluginLoader so it is actually not only possible but is the case unless you use Q_IMPORT_PLUGIN.

              Hope this helps!

              Programmer is an organism that can turn caffeine into code.

              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