Qt编译问题:自定义Qml模块插件运行时出现错误

问题现象

/home/user/Qt/Qt5.6.3/5.6.3/gcc_64/bin/qmlplugindump -nonrelocatable Qt.Custom 0.1 > /home/user/Source/QtCustom/src/imports/custom/plugins.qmltypes
QQmlComponent: Component is not ready
QQmlApplicationEngine failed to load component
qrc:/main.qml:3 plugin cannot be loaded for module "Qt.Custom": Failed to extract plugin meta data from '/home/user/Qt/Qt5.6.3/5.6.3/gcc_64/qml/Qt/Custom/libqtcustomplugin.so'

检查项

qmldir文件

module Qt.Custom
plugin qtcustomplugin
classname QtCustomPlugin
depends QtQuick.Window 2.2

qtcustomplugin.cpp文件(一般问题出现在该文件中)

省略代码块
#include "qtcustomplugin.moc" // 最后一行,检查是否缺少该行

你可能感兴趣的:(Qt,框架,qmldir,qml,plugin)