QPluginLoader cannot load plugin [solved]

  • hello,

    when we trying to load the plugin the QPluginLoader isn't load the plugin and the error string is: "Plugin verification data mismatch in 'PluginImpd.dll'"

    Is there anyone that know the solution of this problem?


  • Lifetime Qt Champion


    Did you setup the plugin metadata correctly ? Do you call the Q_PLUGIN_METADATA macro ?

  • There are many possible sources of problem - from poorly written plugin to plugin built with different toolchain or different CRT.

  • Hi
    I found this link useful


  • @SGaist

    thank you for the answer..
    yes, I called thia macro in the class that implements the plugin interface and then I got many errors like this:
    error: undefined reference to vtable for InPluginInterface' error: undefined reference toInPluginInterface::metaObject() const'
    error: undefined reference to `InPluginInterface::qt_metacast(char const*)'

    etc. ....

    the plugin is not for qt creator, its for a project that i do with qt creator

  • @GrahamL

    this link useful for plugins for widgets..

    my plugin isn't for widget...

  • @LeaA

    Its hard to guess without seeing your code
    Is it possible for you to share your class definitions?

  • why is the QLibraryPrivate::IsNotAPlugin (1)????

  • here is the code:

    the h file of the interface:

    #pragma once

    #include <QtPlugin>
    #include <QObject>
    #include <QtCore>

    #include "ProcessingInterface.h"
    #include "setting.h"
    #include "msstorage.h"
    #include "myplot.h"

    @brief The InPluginInterface class
    Factory of prossesingInterface
    class InPluginInterface//:public QObject
    // Q_OBJECT
    virtual ~InPluginInterface() = default;
    virtual std::shared_ptr <ProcessingInterface> getProcessing
    (myPlotInterface& plot,
    > reduceData)=0;



    the h file of the class that implements the plugin:

    #ifndef INPLUGINIMP_H
    #define INPLUGINIMP_H

    #include <QtScript/QScriptEngine>
    #include <QtScript/QScriptValue>
    #include <memory>

    #include "inPluginInterface.h"
    #include "ProcessingInterface.h"
    #include "impprocessing.h"

    class Q_DECL_EXPORT InPluginImp :public QObject,public InPluginInterface


    // InPluginInterface interface
    std::shared_ptr<ProcessingInterface> getProcessing
    (myPlotInterface &plot,
     QVector<ReducingInterface *> msStorages) override;


    #endif // INPLUGINIMP_H

    the cpp file:

    #include "inpluginimp.h"



    std::shared_ptr <ProcessingInterface> InPluginImp::getProcessing
    ( myPlotInterface& plot,
    QVector<ReducingInterface*> msStorages)

    std::shared_ptr <ProcessingInterface> p=std::make_shared<impProcessing>(plot ,msStorages);
    return p;

    the function that loading the plugin:

    void Manager::loadPlugins()
    pluginsDir = QDir(qApp->applicationDirPath());

    #if defined(Q_OS_WIN)
    if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release")
    #elif defined(Q_OS_MAC)
    if (pluginsDir.dirName() == "MacOS") {
    //search the file that there the plugin declared

    foreach (QString fileName, pluginsDir.entryList(QDir::Files)) {
        QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
        QObject *plugin = loader.instance();
        if (plugin) {
            pluginFileNames += fileName;


    what is the problem here? why the QPluginLoader doesn't load the plugin? why the QLibraryPrivate::IsNotAPlugin (1)????


  • the problem solved

  • Hi
    What was the problem and how did you solve it?

  • @GrahamL

    the problem was that the plugin wasn't created good and the QPluginLoader wasn't recognized it as a plugin.

    i returned the macro Q_OBJECT to InPluginImp class and i moved the inheritance from QOBJECT to the InPluginInterface class.

  • Ah
    Please mark the topic as SOLVED

  • hi,
    now i getting this error:
    C:\workspace\16-5-15\src\mainProject\build-mainProject-Desktop_Qt_5_3_MinGW_32bit-Debug\VisualReceiverErrorsAnalysis\debug\moc_inpluginimp.cpp:149: error: undefined reference to `InPluginImp::InPluginImp()'

    and this one:
    moc_inpluginimp.cpp:-1: error: undefined reference to `InPluginImp::getProcessing(myPlotInterface&, QVector<ReducingInterface*>)'

    collect2.exe:-1: error: error: ld returned 1 exit status

    there is a solution for it?..

  • Lifetime Qt Champion

    Did you properly implement both these functions ? Do you build the corresponding cpp file ?

  • @SGaist


  • @SGaist

    it seems like a problem with the moc.cpp file of inpluginimp

  • when i putting down the Q_OBJECT macro from the inPluginImp class the errors gone but the again the first problem in this topic comming back

  • Lifetime Qt Champion

    When adding/removing the Q_OBJECT macro, do you re-run qmake before building ?

  • @SGaist


  • @SGaist

    it says to me that the moc_inpluginimp.cpp file isn't found..
    but the file is in the build directory of the project in the debuge directory

  • @LeaA said:

    #pragma once

    T_T WTF ?

  • @jalomic

    sorry,i didn't understand you..

  • @jalomic said:

    #pragma once

    #ifndef INPLUGININTERFACE_H and #pragma once - it is the same thinks.
    You not need #ifndef INPLUGININTERFACE_H if you have #pragma once
    Sorry for offtop

  • @LeaA Try to disable "shadow build"

  • @jalomic

    I put down some header files from the pro. file and it solved

Log in to reply