Results 1 to 5 of 5

Thread: Problem with a plugin which depends on another plugin

  1. #1
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Problem with a plugin which depends on another plugin

    Hi, I am trying to make my application as modular as possible by having everything as a plugin. Some of my plugins are self-contained (e.g. plugin A) while others are dependent on other plugins (e.g. plugin B depends on plugin A, more precisely B uses resources and classes which are defined in A).

    Before building A and B as 'proper' plugins, I thought I would first build them as 'pure' shared libraries (note: in case it matters, I use CMake not QMake), and everything builds as expected and I can load A and B using QLibrary. If I use QPluginLoader, then obviously I get told that A and B are not Qt plugins.

    The next step was for me to make A and B 'proper' plugins. I thought I would start with A and disable B, so that I could test the loading of A using QPluginLoader, and indeed everything works as expected and I can load A using QPluginLoader. Next, I made B a 'proper' plugin, but this time round it doesn't build... I get several undefined references to classes that are defined in A and which I need in B.

    Now, could it be that I overlooked something? If so, what could it be? As I said, if I remove the plugin-specific side of things (i.e. Q_EXPORT_PLUGIN2) then everything builds and loads fine.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Problem with a plugin which depends on another plugin

    Care to share some of the errors regarding undefined references? These are usually the result of broken library requirements or search paths... but we could guess forever.

  3. #3
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with a plugin which depends on another plugin

    Yes, sorry about that. Here is the kind of undefined references I get:

    Linking CXX shared library ..\..\..\..\Viewer.dll
    Creating library file: ..\..\..\..\libViewer.dll.a
    CMakeFiles\ViewerPlugin.dir/objects.ammlviewerwidget.cpp.obj):mmlviewerwidget. cpp:(.text+0xd9): undefined reference to `QtMmlWidget::paintEvent(QPaintEvent*)’
    CMakeFiles\ViewerPlugin.dir/objects.a(mmlviewerwidget.cpp.obj):mmlviewerwidget .cpp:(.text+0×11b): undefined reference to `OpenCOR::CommonWidget::drawBorderIfDocked(bool const&, bool const&, bool const&, bool const&, bool const&)’
    …
    collect2: ld returned 1 exit status
    mingw32-make2: *** [Viewer.dll] Error 1
    mingw32-make1: *** [src/plugins/edit/Viewer/CMakeFiles/ViewerPlugin.dir/all] Error 2
    mingw32-make: *** [all] Error 2
    Otherwise, and as I mentioned in my original message, everything works fine if I disable the plugin aspect of my code.

  4. #4
    Join Date
    Nov 2010
    Posts
    57
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with a plugin which depends on another plugin

    I'm no expert in this. But to use my plugins as a library I followed this technique:

    http://doc.qt.nokia.com/4.7-snapshot/sharedlibrary.html

    worked for me...

  5. #5
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with a plugin which depends on another plugin

    Quote Originally Posted by pan View Post
    I'm no expert in this. But to use my plugins as a library I followed this technique:

    http://doc.qt.nokia.com/4.7-snapshot/sharedlibrary.html

    worked for me...
    ... and it is for me too! So, yes, thanks a lot indeed! I guess I didn't expect this to be required since building my various moduled as 'pure' shared libraries was fine. It was just when I was trying to build them as plugins that it wasn't. Anyway, now everything's fine and that's what matters!

Similar Threads

  1. Replies: 7
    Last Post: 11th April 2013, 11:55
  2. Replies: 1
    Last Post: 8th October 2010, 12:38
  3. Plugin and shared class between plugin and application
    By wishper in forum Qt Programming
    Replies: 7
    Last Post: 23rd August 2010, 18:00
  4. Replies: 0
    Last Post: 16th September 2009, 03:33
  5. Using KDE plugin problem
    By ccp in forum KDE Forum
    Replies: 1
    Last Post: 16th February 2009, 23:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.