Plugin error while loading in application uisng cmake
-
hai i am trying crete a simple plugin using CMakeList.txt in windows. but i ma facing an error i tried so many ways but i am not getting how to resolved this error please hepl me to resolve this.
cmake_minimum_required(VERSION 3.16) project(WComponents 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 Core Quick REQUIRED) find_package(Qt6 REQUIRED COMPONENTS Core ) # qt_add_library(WComponents STATIC) qt_add_qml_module(WComponents URI "com.WComponents" CLASS_NAME WComponentsPlugin PLUGIN_TARGET WComponentsPlugin VERSION 1.0 QML_FILES CustomBtn.qml SOURCES WComponents_plugin.cpp WComponents_plugin.h WAction.h WAction.cpp ) set_target_properties(WComponents 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(WComponents PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_link_libraries(WComponents PRIVATE Qt6::Quick Qt6::Core ) target_link_libraries(WComponents PRIVATE Qt6::Core) # target_link_libraries(WComponents PRIVATE Qt6::Core) target_include_directories(WComponents PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})this is my plugin cmake .
i am not added anything in application cmake but in main.cpp i am loading usingenine.addImportPath("D:\\rangaWorkspace\\WComponentsLoader")and in my main.qml i am iporting like this
import com.WComponents 1.0 or import com.WComponentsbut when i launch my application i am getting below error
QQmlApplicationEngine failed to load component qrc:/qt/qml/WComponentsLoader/Main.qml:2:1: Cannot load library D:\rangaWorkspace\WComponentsLoader\com\WComponents\WComponentsPlugin.dll: The specified module could not be found.please help me to resolve this error.
ThankYou. -
hai i am trying crete a simple plugin using CMakeList.txt in windows. but i ma facing an error i tried so many ways but i am not getting how to resolved this error please hepl me to resolve this.
cmake_minimum_required(VERSION 3.16) project(WComponents 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 Core Quick REQUIRED) find_package(Qt6 REQUIRED COMPONENTS Core ) # qt_add_library(WComponents STATIC) qt_add_qml_module(WComponents URI "com.WComponents" CLASS_NAME WComponentsPlugin PLUGIN_TARGET WComponentsPlugin VERSION 1.0 QML_FILES CustomBtn.qml SOURCES WComponents_plugin.cpp WComponents_plugin.h WAction.h WAction.cpp ) set_target_properties(WComponents 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(WComponents PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_link_libraries(WComponents PRIVATE Qt6::Quick Qt6::Core ) target_link_libraries(WComponents PRIVATE Qt6::Core) # target_link_libraries(WComponents PRIVATE Qt6::Core) target_include_directories(WComponents PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})this is my plugin cmake .
i am not added anything in application cmake but in main.cpp i am loading usingenine.addImportPath("D:\\rangaWorkspace\\WComponentsLoader")and in my main.qml i am iporting like this
import com.WComponents 1.0 or import com.WComponentsbut when i launch my application i am getting below error
QQmlApplicationEngine failed to load component qrc:/qt/qml/WComponentsLoader/Main.qml:2:1: Cannot load library D:\rangaWorkspace\WComponentsLoader\com\WComponents\WComponentsPlugin.dll: The specified module could not be found.please help me to resolve this error.
ThankYou.@Rangantha-B-V No need to ask same question twice (https://forum.qt.io/topic/163207/qml-plugin-load-error/4?_=1757653705393).
In that other thread - did you react to the comment from @JKSH ? -
A Axel Spoerl locked this topic on