QML Plugin Load Error
-
I am working on a Qt 6 project that contains both a QML plugin (built with qt_add_qml_module) and a shared C++ library. I want to use the shared library’s classes inside plugin and this plugin will expose .qml files .
i will use this plugin qml files in my application this is what i need to achive but i am facing an error.target_link_librariesusing a above line i linked librray to plugin.
But when i try to use the plugin in other aplication i am getting below error.QQmlApplicationEngine failed to load component qrc:/main.qml:3:1: Cannot load library D:\MyWorkspace\MyPluginLoader\build\Desktop_Qt_6_9_1_MinGW_64_bit-Debug\bin\WeinigComponentsExtPluginplugin\WeinigComponentsExtPluginpluginplugin.dll: The specified module could not be found.but in aplication when i load a library using QLibrary and then trying to use plugin the application is launching and it works fine.
insted of loading libabry if i try to load plugin i am facing this issue . -
I am working on a Qt 6 project that contains both a QML plugin (built with qt_add_qml_module) and a shared C++ library. I want to use the shared library’s classes inside plugin and this plugin will expose .qml files .
i will use this plugin qml files in my application this is what i need to achive but i am facing an error.target_link_librariesusing a above line i linked librray to plugin.
But when i try to use the plugin in other aplication i am getting below error.QQmlApplicationEngine failed to load component qrc:/main.qml:3:1: Cannot load library D:\MyWorkspace\MyPluginLoader\build\Desktop_Qt_6_9_1_MinGW_64_bit-Debug\bin\WeinigComponentsExtPluginplugin\WeinigComponentsExtPluginpluginplugin.dll: The specified module could not be found.but in aplication when i load a library using QLibrary and then trying to use plugin the application is launching and it works fine.
insted of loading libabry if i try to load plugin i am facing this issue .@Rangantha-B-V said in QML Plugin Load Error:
Cannot load library D:\MyWorkspace\MyPluginLoader\build\Desktop_Qt_6_9_1_MinGW_64_bit-Debug\bin\WeinigComponentsExtPluginplugin\WeinigComponentsExtPluginpluginplugin.dll: The specified module could not be found.This usually means: One or more of the dependencies of WeinigComponentsExtPluginpluginplugin.dll is not in your PATH or your executable's folder.
-
@Redman this is my plugin cmake .
cmake_minimum_required(VERSION 3.16) project(MyDbsComponents VERSION 0.1 LANGUAGES CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) find_package(Qt6 6.2 COMPONENTS Quick REQUIRED) find_package(Qt6 REQUIRED COMPONENTS Core) find_package(Qt6 REQUIRED COMPONENTS Core) qt_add_library(MyDbsComponents SHARED) qt_add_qml_module(MyDbsComponents URI com.pthinks.dbcomponents VERSION 1.0 # QML_FILES MyItemControls.qml SOURCES MyItem.cpp MyItem.h DbsComponentsPlugin.h DbsComponentsPlugin.cpp # QML_FILES DbsCheckBoxValue.qml Person.h Person.cpp RESOURCES qml.qrc ) set_target_properties(MyDbsComponents PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE # WIN32_EXECUTABLE TRUE ) target_compile_definitions(MyDbsComponents PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_link_libraries(MyDbsComponents PRIVATE Qt6::Quick) target_link_libraries(MyDbsComponents PRIVATE Qt6::Core) target_link_libraries(MyDbsComponents PRIVATE Qt6::Core) target_include_directories(MyDbsComponents PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) # target_link_libraries(MyDbsComponents PRIVATE Qt6::Quick Qt6::Core Qt6::Qml)in my application i am linking like this
engine.addImportPath("D:\\rangaWorkspace\\MyDbsComponents\\build\\Desktop_Qt_6_9_1_MinGW_64_bit-Debug");and i ma not addor modify anything in my appliaction CMake
and in main.qml i am trying to import like thisimport com.pthinks.dbcomponents 1.0 -
J jsulm referenced this topic on
-
@JKSH in top i shred my plugin cmake please refer and tell me if anything i missed .
when ever i try to build a plugin it will create folder inside the build directory and followed by the uri "com.pthinks.dbcomponents" .
when i load my apliaction and using a path upto the build directory and if i run my appliaction it will give me an above error.
is any .dll i need to explictly copy and paste inside "dbcomponts" folder or is this enough. -
@JKSH in top i shred my plugin cmake please refer and tell me if anything i missed .
when ever i try to build a plugin it will create folder inside the build directory and followed by the uri "com.pthinks.dbcomponents" .
when i load my apliaction and using a path upto the build directory and if i run my appliaction it will give me an above error.
is any .dll i need to explictly copy and paste inside "dbcomponts" folder or is this enough.@Rangantha-B-V Please check that all the dependencies of WeinigComponentsExtPluginpluginplugin.dll are either in your PATH or in your executable's folder.
You can use https://github.com/lucasg/Dependencies to see what dependencies/DLLs it needs.
-
I Got the solution to this problem .
we need to add System Environment path.
like where that .dll are present upto that we need to specify . -