c++ - "plugin verification data mismatch"while loading plugin for qt5 project

标签 c++ qt plugins qt5

我有带有两个简单插件的原始(无 QtDesigner)Qt5 项目,其中一个没有加载简洁错误:“插件验证数据不匹配”。

第一个插件的 header (加载并运行良好):

#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

第二个,不加载:

#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

这是 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

我不是专家,为 qt5 编写插件的描述非常粗略。但由于我找不到这些插件之间的任何主要区别,问题对我来说变得相当神秘。也许是 Qt 中的错误?我已经重建了几次,以确保它们都是最新的。

我正在尝试将整个代码放入网络中的某处,但这需要一段时间... 编辑:完成 - 在此处打包为 zip:http://uploaduj.net/D74c2f/v0-1-pure-zip/

最佳答案

不确定是否有帮助,但您的插件似乎包含无效元数据。这是设置错误消息的代码 http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/plugin/qlibrary.cpp#n303

您可以使用 Qt 的调试版本并在该函数中设置断点。这将为您提供加载插件时失败的确切行。

也许您的元数据有误?

关于c++ - "plugin verification data mismatch"while loading plugin for qt5 project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30141951/

相关文章:

plugins - CKEditor插件: text fields not editable

zend-framework - 如何访问 Zend Framework 插件中的 Layout 对象?

c++ - 为什么我的词法分析器无法识别引号 ""

c++ - OpenGL 线宽

javascript - C++ 和远程 Javascript 之间的通信

c++ - PushBack(push_back()) QStringList 的元素到 vector<string>

Qt 5 : Debug\release and Release\debug directories

c++ - 将 vera++(或其他编码约定工具)与 Qt/QtCreator 集成

c++ - 使用流的命令行浮点输入和输出

iOS - 事后获取自进程开始时间