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. Qt plugin error, message in load "cannot load library"
QtWS25 Last Chance

Qt plugin error, message in load "cannot load library"

Scheduled Pinned Locked Moved General and Desktop
qtplugin
2 Posts 2 Posters 2.9k 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
    Arturo Pablo R
    wrote on 9 Mar 2015, 22:43 last edited by
    #1

    I use Qt 5.3.2 with msvc 2010, I have the following use case, create an interface class and this class is used in a Qt plugin, the program and plugins compile fine, but when I execute the program and this try instance or load plugins, mark "cannot load library ..., the specified module could not be found.
    This is header of Interface:

       class ServicesInterface{
    
      public:
        virtual ~ServicesInterface() {}
    
    virtual QString name()  = 0;
    virtual int port() = 0;
    }
     Q_DECLARE_INTERFACE(ServicesInterface, "services.ServicesInterface");
    

    The header of plugin is this:

      class BusControllerPlugin : public QObject, public ServicesInterface{
         Q_OBJECT
         Q_PLUGIN_METADATA(IID "busControllerPlugin.ServicesInterface")
          Q_INTERFACES(ServicesInterface)  
        public:
         BusControllerPlugin();
        ~BusControllerPlugin();
     }
    

    And this is how I try to load and instantiate the plugins, in the main.cpp.

       QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
        qDebug() << "fileName: " << pluginsDir.absoluteFilePath(fileName);
    
        loader.load();
        if(ServicesInterface *interface =          qobject_cast<ServicesInterface *>(loader->instance())) {
        connect(interface, SIGNAL(pluginSend(const DeviceMessage&)), this, SLOT(msgFromPlugin(const DeviceMessage&)));
    
          interfaces.append(interface);**strong text**
         }
      else{
        qDebug()<<"error loading plugin:"<<loader.errorString()<<";metadata:"<<loader.metaData();
     }
    

    I read many tutorials and I don't see difference, this system was compiled with Qt 5.2, but actually I use 5.3.2, and happens this, exist new guide or form to create and load plugins? Or I missed something.

    Pd. I not use Qt Creator, i compile with custom script, the compilation is fine.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 10 Mar 2015, 20:17 last edited by
      #2

      Hi and welcome to devnet,

      Do you mean that you are using the plugin compiled with 5.2 with a 5.3.2 built project ?

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

      1 Reply Last reply
      0

      2/2

      10 Mar 2015, 20:17

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved