Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Plugin Load Error
Forum Updated to NodeBB v4.3 + New Features

QML Plugin Load Error

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
8 Posts 4 Posters 951 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rangantha B V
    wrote on last edited by Rangantha B V
    #1

    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_libraries
    

    using 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 .

    JKSHJ 1 Reply Last reply
    0
    • R Offline
      R Offline
      Redman
      wrote on last edited by
      #2

      Please post the relevant parts of your CMakeLists and main.qml.

      1 Reply Last reply
      0
      • R Rangantha B V

        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_libraries
        

        using 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 .

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        @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.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        1
        • R Offline
          R Offline
          Rangantha B V
          wrote on last edited by Rangantha B V
          #4

          @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 this

          import com.pthinks.dbcomponents 1.0
          
          1 Reply Last reply
          0
          • jsulmJ jsulm referenced this topic on
          • R Offline
            R Offline
            Rangantha B V
            wrote on last edited by
            #5

            @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.

            JKSHJ 1 Reply Last reply
            0
            • R Rangantha B V

              @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.

              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              @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.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              2
              • R Offline
                R Offline
                Rangantha B V
                wrote on last edited by
                #7

                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 .

                1 Reply Last reply
                0
                • dheerendraD Offline
                  dheerendraD Offline
                  dheerendra
                  Qt Champions 2022
                  wrote on last edited by
                  #8

                  https://forum.qt.io/topic/158541/windows-qt_add_qml_module-failed-to-load-the-plugin
                  This may help

                  Dheerendra
                  @Community Service
                  Certified Qt Specialist
                  http://www.pthinks.com

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved