CMake failed to load QWebWidgets module
-
@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?
-
Excuse me to insist but: which compiler are you using ?
-
@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.
-
@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)
-
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
-
I met the same error as you did. And it seems that the reason of my situation is because:
WebEngineWidgets
has aWebEngineCore
dependency- but
WebEngineCore
cannot find itsPositioning
dependency.
Therefore, after I install "Qt Positioning" module in Qt Maintainance Tools, the error disappeared.
-
@Haowei-Hsu you saved my day ^^. Thank you. Qt Positioning really fix this issue on my Qt 6.8