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. Abstract plugin inheritance error
Forum Updated to NodeBB v4.3 + New Features

Abstract plugin inheritance error

Scheduled Pinned Locked Moved Solved General and Desktop
23 Posts 4 Posters 6.6k Views 3 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by SGaist
    #14

    Roughly :
    pluginfoo.pro

    QT          += core gui
    TARGET       = pluginfoo
    TEMPLATE     = lib
    CONFIG      += plugin
    DESTDIR      = $$OUTPWD/bin/plugins
    LIBS += -L$$OUTPWD/lib -lmycoollib
    DEFINES     += QT_DEPRECATED_WARNINGS
    INCLUDEPATH += ../mycoollib
    SOURCES     += pluginfoo.cpp
    HEADERS     += pluginfoo.hpp
    DISTFILES   += pluginfoo.json
    

    mycoollib.pro

    QT          += core gui
    TARGET       = mycoollib
    TEMPLATE  = lib
    DESTDIR      = $$OUTPWD/lib
    INCLUDEPATH += .
    SOURCES     += \
        abstractplugin.cpp
    HEADERS     += \
        plugininterface.hpp
        abstractplugin.hpp
    
    

    myproject.pro

    QT      += core gui widgets xml network
    TARGET   = myproject
    TEMPLATE = app
    DESTDIR  = $$OUTPWD/bin
    LIBS += -L$$OUTPWD/lib -lmycoollib
    INCLUDEPATH += ../mycoollib
    DEFINES += QT_DEPRECATED_WARNINGS
    SOURCES += src/main.cpp \
               gui/myprojectwindow.cpp
    
    HEADERS += gui/myprojectwindow.hpp
    

    Project structure

    mycoolproject \
    ---- mycoollib
    ---- pluginfoo
    ---- myproject
    

    mycoolproject being a SUBDIR project building first mycoollib and then pluginfoo and myproject.

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

    D 1 Reply Last reply
    1
    • SGaistS SGaist

      Roughly :
      pluginfoo.pro

      QT          += core gui
      TARGET       = pluginfoo
      TEMPLATE     = lib
      CONFIG      += plugin
      DESTDIR      = $$OUTPWD/bin/plugins
      LIBS += -L$$OUTPWD/lib -lmycoollib
      DEFINES     += QT_DEPRECATED_WARNINGS
      INCLUDEPATH += ../mycoollib
      SOURCES     += pluginfoo.cpp
      HEADERS     += pluginfoo.hpp
      DISTFILES   += pluginfoo.json
      

      mycoollib.pro

      QT          += core gui
      TARGET       = mycoollib
      TEMPLATE  = lib
      DESTDIR      = $$OUTPWD/lib
      INCLUDEPATH += .
      SOURCES     += \
          abstractplugin.cpp
      HEADERS     += \
          plugininterface.hpp
          abstractplugin.hpp
      
      

      myproject.pro

      QT      += core gui widgets xml network
      TARGET   = myproject
      TEMPLATE = app
      DESTDIR  = $$OUTPWD/bin
      LIBS += -L$$OUTPWD/lib -lmycoollib
      INCLUDEPATH += ../mycoollib
      DEFINES += QT_DEPRECATED_WARNINGS
      SOURCES += src/main.cpp \
                 gui/myprojectwindow.cpp
      
      HEADERS += gui/myprojectwindow.hpp
      

      Project structure

      mycoolproject \
      ---- mycoollib
      ---- pluginfoo
      ---- myproject
      

      mycoolproject being a SUBDIR project building first mycoollib and then pluginfoo and myproject.

      D Offline
      D Offline
      Defohin
      wrote on last edited by
      #15

      @SGaist Do I have to link with -l every single plugin I have? Or I can just provide a path like -L and it's going to work?

      I will try to modify here based on your example.

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

        You don't link the plugins. You link your plugins against that common library.

        Yes, you have to use both -land -L.

        -L just tells the linker where to look at.

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

        D 1 Reply Last reply
        1
        • SGaistS SGaist

          You don't link the plugins. You link your plugins against that common library.

          Yes, you have to use both -land -L.

          -L just tells the linker where to look at.

          D Offline
          D Offline
          Defohin
          wrote on last edited by
          #17

          @SGaist It works, but I have another question now.

          I named the "commonlib" to "pluginmanager" this class will hold information about plugins, load, unload and so on using QPluginLoader, but... when I try to use it on the main application including the header pluginmanager.hpp it says that it cannot open the file, even if I have the INCLUDEPATH += ../pluginmanager. On Qt Creator it does work, I'm able to ctrl+click, etc, but when I try to compile I get this error.

          jsulmJ 1 Reply Last reply
          0
          • D Defohin

            @SGaist It works, but I have another question now.

            I named the "commonlib" to "pluginmanager" this class will hold information about plugins, load, unload and so on using QPluginLoader, but... when I try to use it on the main application including the header pluginmanager.hpp it says that it cannot open the file, even if I have the INCLUDEPATH += ../pluginmanager. On Qt Creator it does work, I'm able to ctrl+click, etc, but when I try to compile I get this error.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by jsulm
            #18

            @Defohin Did you run qmake again after changing the pro file? After qmake you should do a complete rebuild.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            D 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Defohin Did you run qmake again after changing the pro file? After qmake you should do a complete rebuild.

              D Offline
              D Offline
              Defohin
              wrote on last edited by
              #19

              @jsulm It works, but now I'm getting unresolved external symbol on the main project when trying to use PluginManager manager on the MyProjectWindow, and I have LIBS += -L../libs -lpluginmanager on the pro file.

              myprojectwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl PluginManager::PluginManager(class QObject *)" (??0PluginManager@@QEAA@PEAVQObject@@@Z) referenced in function "public: __cdecl MyProjectWindow::MyProjectWindow(class QWidget *)" (??0MyProjectWindow@@QEAA@PEAVQWidget@@@Z)

              jsulmJ 1 Reply Last reply
              0
              • D Defohin

                @jsulm It works, but now I'm getting unresolved external symbol on the main project when trying to use PluginManager manager on the MyProjectWindow, and I have LIBS += -L../libs -lpluginmanager on the pro file.

                myprojectwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl PluginManager::PluginManager(class QObject *)" (??0PluginManager@@QEAA@PEAVQObject@@@Z) referenced in function "public: __cdecl MyProjectWindow::MyProjectWindow(class QWidget *)" (??0MyProjectWindow@@QEAA@PEAVQWidget@@@Z)

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #20

                @Defohin ../libs is a relative path, are you sure it is correct?
                Can you post the compiler/linker call just before the error message?
                As suggested by @SGaist : LIBS += -L$$OUTPWD/lib -lmycoollib (pluginmanager instead of mycoollib)

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                D 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @Defohin ../libs is a relative path, are you sure it is correct?
                  Can you post the compiler/linker call just before the error message?
                  As suggested by @SGaist : LIBS += -L$$OUTPWD/lib -lmycoollib (pluginmanager instead of mycoollib)

                  D Offline
                  D Offline
                  Defohin
                  wrote on last edited by
                  #21

                  @jsulm I'm using $$OUTPWD now but it still doesn't work.

                  jsulmJ 1 Reply Last reply
                  0
                  • D Defohin

                    @jsulm I'm using $$OUTPWD now but it still doesn't work.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #22

                    @Defohin Is the resulting path correct and is the lib there?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      Defohin
                      wrote on last edited by Defohin
                      #23

                      It's working now, I forgot to put MYPROJECT_EXPORT on PluginManager class.

                      I love you guys ♥

                      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