I have raw (no QtDesigner) Qt5 project with two simple plugins, which one don't load with laconic error: "plugin verification data mismatch".
Header of first plugin (which loads and run well):
#ifndef __PIROGRONIAN__P2P2__GUI_PLUGIN__H__
#define __PIROGRONIAN__P2P2__GUI_PLUGIN__H__
#include "QtCore/QtCore"
#include "PluginInterface.h"
namespace P2P2 {
class GuiPlugin : public QObject, public PluginInterface {
Q_OBJECT
Q_PLUGIN_METADATA(IID "Pirogronian.P2P2.GuiPlugin")
Q_INTERFACES(P2P2::PluginInterface)
public:
bool init(CoreServer *);
bool receiveObject(Object*);
int channelType();
};
};
#endif
The second one, which don't load:
#ifndef __PIROGRONIAN__P2P2__CHAT_PLUGIN__H__
#define __PIROGRONIAN__P2P2__CHAT_PLUGIN__H__
#include <QtNetwork/QtNetwork>
#include "Chat.h"
#include "PluginInterface.h"
namespace P2P2 {
class ChatPlugin : public QObject, public PluginInterface {
Q_OBJECT
Q_PLUGIN_METADATA(IID "Pirogronian.P2P2.ChatPlugin")
Q_INTERFACES(P2P2::PluginInterface)
CoreServer *_server;
QHash<Channel *, Chat *> _chats;
public:
virtual bool init(CoreServer *);
virtual bool receiveObject(Object *);
virtual int channelType();
};
};
//Q_DECLARE_METATYPE(QPointer<P2P2::ChatPlugin>)
#endif
Here is PluginInterface header:
#ifndef __PIROGRONIAN__P2P2__PLUGIN_INTERFACE__H__
#define __PIROGRONIAN__P2P2__PLUGIN_INTERFACE__H__
#include "CoreServer.h"
namespace P2P2 {
class PluginInterface {
public:
virtual bool init(CoreServer *) = 0;
virtual bool receiveObject(Object *) = 0;
virtual int channelType() = 0;
};
};
Q_DECLARE_INTERFACE(P2P2::PluginInterface, "Pirogronian/P2P2/PluginInterface/1.0")
#endif
I'm not expert and writing plugins for qt5 is described very cursorily. But since I can't find any major difference between those plugins, problem becomes rather mysterious to me. Mayby a bug in Qt? I've rebuilt both several times to bye sure that both are up to date.
I'm trying put the whole code somewhere into net, but it'll take a while... Edit: done - packed as zip here: http://uploaduj.net/D74c2f/v0-1-pure-zip/
Not sure if it helps but it seems that your plugin has invalid metadata. Here's code that sets error message http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/plugin/qlibrary.cpp#n303
You could use debug version of Qt and set breakpoint in that function. This would give you exact line that fails while loading your plugin.
Maybe you have an error in your metadata?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With