Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. CMake failed to load QWebWidgets module
Forum Updated to NodeBB v4.3 + New Features

CMake failed to load QWebWidgets module

Scheduled Pinned Locked Moved Unsolved QtWebEngine
17 Posts 5 Posters 4.6k 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.
  • jsulmJ jsulm

    @KaiKai Has nothing to do with QWebEngine.
    You did not define build target "dev-mini" in your CMake file. You need to do so first.
    Like (if you want to build an executable):

    add_executable(dev-mini)
    
    K Offline
    K Offline
    KaiKai
    wrote on last edited by
    #4

    @jsulm
    Would you mind to teach me where to put it?

    cmake_minimum_required(VERSION 3.5)
    project(dev-mini
        VERSION 0.1.0
        LANGUAGES CXX
    )
    
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    
    set(CMAKE_AUTOUIC ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
    find_package(QT NAMES Qt6 REQUIRED COMPONENTS Gui)
    find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets)
    find_package(Qt6 REQUIRED COMPONENTS Widgets)
    find_package(QT NAMES Qt6 REQUIRED COMPONENTS WebEngineWidgets)
    
    set(PROJECT_SOURCES
        global/error.hpp
        global/error.cpp
        ui/object.hpp
        ui/object.cpp
        ui/mainwindow.hpp
        ui/mainwindow.cpp
        ui/translator.hpp
        ui/translator.cpp
        ui/workspace.hpp
        ui/workspace.cpp
        ui/icon.hpp
        ui/icon.cpp
        main.cpp
    )
    set(PROJECT_RESOURCES
        resource/icon.qrc
    )
    
    qt_add_executable(dev-mini
        MANUAL_FINALIZATION
        ${PROJECT_SOURCES}
        ${PROJECT_RESOURCES}
    )
    
    target_link_libraries(dev-mini PRIVATE Qt6::Widgets)
    target_link_libraries(dev-mini PRIVATE Qt6::WebEngineWidgets)
    
    set_target_properties(dev-mini PROPERTIES
        MACOSX_BUNDLE_GUI_IDENTIFIER dev.starlight.work/product/dev-mini
        MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
        MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
        MACOSX_BUNDLE TRUE
        WIN32_EXECUTABLE TRUE
    )
    
    install(TARGETS dev-mini
        BUNDLE DESTINATION .
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    )
    
    qt_finalize_executable(dev-mini)
    
    jsulmJ 1 Reply Last reply
    0
    • K KaiKai

      @jsulm
      Would you mind to teach me where to put it?

      cmake_minimum_required(VERSION 3.5)
      project(dev-mini
          VERSION 0.1.0
          LANGUAGES CXX
      )
      
      set(CMAKE_INCLUDE_CURRENT_DIR ON)
      
      set(CMAKE_AUTOUIC ON)
      set(CMAKE_AUTOMOC ON)
      set(CMAKE_AUTORCC ON)
      
      set(CMAKE_CXX_STANDARD 17)
      set(CMAKE_CXX_STANDARD_REQUIRED ON)
      
      find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
      find_package(QT NAMES Qt6 REQUIRED COMPONENTS Gui)
      find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets)
      find_package(Qt6 REQUIRED COMPONENTS Widgets)
      find_package(QT NAMES Qt6 REQUIRED COMPONENTS WebEngineWidgets)
      
      set(PROJECT_SOURCES
          global/error.hpp
          global/error.cpp
          ui/object.hpp
          ui/object.cpp
          ui/mainwindow.hpp
          ui/mainwindow.cpp
          ui/translator.hpp
          ui/translator.cpp
          ui/workspace.hpp
          ui/workspace.cpp
          ui/icon.hpp
          ui/icon.cpp
          main.cpp
      )
      set(PROJECT_RESOURCES
          resource/icon.qrc
      )
      
      qt_add_executable(dev-mini
          MANUAL_FINALIZATION
          ${PROJECT_SOURCES}
          ${PROJECT_RESOURCES}
      )
      
      target_link_libraries(dev-mini PRIVATE Qt6::Widgets)
      target_link_libraries(dev-mini PRIVATE Qt6::WebEngineWidgets)
      
      set_target_properties(dev-mini PROPERTIES
          MACOSX_BUNDLE_GUI_IDENTIFIER dev.starlight.work/product/dev-mini
          MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
          MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
          MACOSX_BUNDLE TRUE
          WIN32_EXECUTABLE TRUE
      )
      
      install(TARGETS dev-mini
          BUNDLE DESTINATION .
          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
      )
      
      qt_finalize_executable(dev-mini)
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #5

      @KaiKai said in CMake failed to load QWebWidgets module:

      qt_add_executable(dev-mini

      You already have it. Did you add it after my suggestion or was it already there but you get that CMake error?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      0
      • jsulmJ jsulm

        @KaiKai said in CMake failed to load QWebWidgets module:

        qt_add_executable(dev-mini

        You already have it. Did you add it after my suggestion or was it already there but you get that CMake error?

        K Offline
        K Offline
        KaiKai
        wrote on last edited by
        #6

        @jsulm said in CMake failed to load QWebWidgets module:

        You already have it. Did you add it after my suggestion or was it already there but you get that CMake error?

        It was already there but I get that CMake error.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #7

          Excuse me to insist but: which compiler are you using ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          K 1 Reply Last reply
          0
          • SGaistS SGaist

            Excuse me to insist but: which compiler are you using ?

            K Offline
            K Offline
            KaiKai
            wrote on last edited by
            #8

            @SGaist said in CMake failed to load QWebWidgets module:

            Excuse me to insist but: which compiler are you using ?

            This?
            alt text

            jsulmJ 1 Reply Last reply
            0
            • K KaiKai

              @SGaist said in CMake failed to load QWebWidgets module:

              Excuse me to insist but: which compiler are you using ?

              This?
              alt text

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #9

              @KaiKai This is CMake, not compiler. Please show what compiler you're using.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              K 1 Reply Last reply
              0
              • jsulmJ jsulm

                @KaiKai This is CMake, not compiler. Please show what compiler you're using.

                K Offline
                K Offline
                KaiKai
                wrote on last edited by
                #10

                @jsulm Or this? (I'm sorry, I'm only a newbie)

                jsulmJ 1 Reply Last reply
                0
                • K KaiKai

                  @jsulm Or this? (I'm sorry, I'm only a newbie)

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #11

                  @KaiKai Ell, you could also simply show what compiler is set in the Kit, but from the last screen-shot it is at least visible that you're using MinGW. To use WebEngine you have to use Microsoft compiler (because the used Google Chromium engine only supports Microsoft compiler). So, you have to install Microsoft Visual Studio (or build tools) and Qt for Microsoft compiler.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  K 1 Reply Last reply
                  1
                  • jsulmJ jsulm

                    @KaiKai Ell, you could also simply show what compiler is set in the Kit, but from the last screen-shot it is at least visible that you're using MinGW. To use WebEngine you have to use Microsoft compiler (because the used Google Chromium engine only supports Microsoft compiler). So, you have to install Microsoft Visual Studio (or build tools) and Qt for Microsoft compiler.

                    K Offline
                    K Offline
                    KaiKai
                    wrote on last edited by
                    #12

                    @jsulm I have changed the compiler to MSVC. Everything else has been successful, but CMake has not found this module so far.

                    find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets)
                    
                    D:\Code\C++\project\dev-mini\dev-mini\ui\workspace.hpp:9: error: C1083: 无法打开包括文件: “QtWebView/QWebEngineView”: No such file or directory
                    
                    D:\Qt\Tools\CMake_64\share\cmake-3.23\Modules\CMakeFindDependencyMacro.cmake:47: warning: Found package configuration file: D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineCore/Qt6WebEngineCoreConfig.cmake but it set Qt6WebEngineCore_FOUND to FALSE so package "Qt6WebEngineCore" is considered to be NOT FOUND.  Reason given by package: Qt6WebEngineCore could not be found because dependency Qt6WebChannel could not be found. D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:14 (find_dependency) D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineWidgets/Qt6WebEngineWidgetsDependencies.cmake:96 (_qt_internal_find_dependencies) D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineWidgets/Qt6WebEngineWidgetsConfig.cmake:40 (include) D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:209 (find_package) CMakeLists.txt:22 (find_package)
                    
                    jsulmJ 1 Reply Last reply
                    0
                    • K KaiKai

                      @jsulm I have changed the compiler to MSVC. Everything else has been successful, but CMake has not found this module so far.

                      find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets)
                      
                      D:\Code\C++\project\dev-mini\dev-mini\ui\workspace.hpp:9: error: C1083: 无法打开包括文件: “QtWebView/QWebEngineView”: No such file or directory
                      
                      D:\Qt\Tools\CMake_64\share\cmake-3.23\Modules\CMakeFindDependencyMacro.cmake:47: warning: Found package configuration file: D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineCore/Qt6WebEngineCoreConfig.cmake but it set Qt6WebEngineCore_FOUND to FALSE so package "Qt6WebEngineCore" is considered to be NOT FOUND.  Reason given by package: Qt6WebEngineCore could not be found because dependency Qt6WebChannel could not be found. D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:14 (find_dependency) D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineWidgets/Qt6WebEngineWidgetsDependencies.cmake:96 (_qt_internal_find_dependencies) D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineWidgets/Qt6WebEngineWidgetsConfig.cmake:40 (include) D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:209 (find_package) CMakeLists.txt:22 (find_package)
                      
                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #13

                      @KaiKai Did you install QtWebView module for Qt/MSVC?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      K 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @KaiKai Did you install QtWebView module for Qt/MSVC?

                        K Offline
                        K Offline
                        KaiKai
                        wrote on last edited by
                        #14

                        @jsulm I've installed WebEngine and WebView module in Qt Maintenance Tool.

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          KaiKai
                          wrote on last edited by
                          #15
                          D:\Qt\6.2.4\msvc2019_64\lib\cmake\Qt6\Qt6Config.cmake:209: warning: Found package configuration file: D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineCore/Qt6WebEngineCoreConfig.cmake but it set Qt6WebEngineCore_FOUND to FALSE so package "Qt6WebEngineCore" is considered to be NOT FOUND.  Reason given by package: Qt6WebEngineCore could not be found because dependency Qt6Positioning could not be found. CMakeLists.txt:22 (find_package)
                          D:\Code\C++\project\dev-mini\dev-mini\CMakeLists.txt:22: error: Found package configuration file: D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT FOUND.  Reason given by package: Failed to find Qt component "WebEngineCore". Expected Config file at "D:/Qt/6.2.4/msvc2019_64/lib/cmake/Qt6WebEngineCore/Qt6WebEngineCoreConfig.cmake" exists
                          :-1: error: CMake process exited with exit code 1.
                          :-1: error: CMake returned error code: 1
                          
                          1 Reply Last reply
                          0
                          • Haowei HsuH Offline
                            Haowei HsuH Offline
                            Haowei Hsu
                            wrote on last edited by
                            #16

                            I met the same error as you did. And it seems that the reason of my situation is because:

                            • WebEngineWidgets has a WebEngineCore dependency
                            • but WebEngineCore cannot find its Positioning dependency.

                            Therefore, after I install "Qt Positioning" module in Qt Maintainance Tools, the error disappeared.

                            ba687165-9e98-4977-8342-2768ad674e48-image.png

                            K 1 Reply Last reply
                            2
                            • Haowei HsuH Haowei Hsu

                              I met the same error as you did. And it seems that the reason of my situation is because:

                              • WebEngineWidgets has a WebEngineCore dependency
                              • but WebEngineCore cannot find its Positioning dependency.

                              Therefore, after I install "Qt Positioning" module in Qt Maintainance Tools, the error disappeared.

                              ba687165-9e98-4977-8342-2768ad674e48-image.png

                              K Offline
                              K Offline
                              Khang.DT
                              wrote on last edited by
                              #17

                              @Haowei-Hsu you saved my day ^^. Thank you. Qt Positioning really fix this issue on my Qt 6.8

                              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