Can't set up CMake. Getting errors.
-
@SGaist I only used Qt Design Studio. I wanted to create the GUI there and then edit its functionality in VSCode.
upd: But there is an option in Qt Design Studio to choose a kit down below. I didn't change it after I launched the studio. -
"CMAKE_PREFIX_PATH": "D:/Programming/Qt_Designer/6.5.2/msvc2019_64/lib/cmake"
is wrong. You only need:
"CMAKE_PREFIX_PATH": "D:/Programming/Qt_Designer/6.5.2/msvc2019_64"
Being a
prefix
CMake will automatically try out appending the suffixlib/cmake
by itself ...It's a classic error with no easy fix, but teaching people what not to do ...
-
@cristian-adam I just tried it, but I encountered the same issue.
[main] Configuring project: japanese_app_v2 [proc] Executing command: D:\Programming\CMake\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_PREFIX_PATH:STRING=D:/Programming/Qt_Designer/6.5.2/msvc2019_64 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\mingw64\bin\g++.exe -SC:/Users/YuriiButNotYuri/Desktop/japanese_app_v2/qt_gui/Japanese_app_v20_gui -Bc:/Users/YuriiButNotYuri/Desktop/japanese_app_v2/build -G "MinGW Makefiles" [cmake] Not searching for unused variables given on the command line. [cmake] -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) [cmake] CMake Error at D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6EntryPointPrivate/Qt6EntryPointPrivateTargets.cmake:99 (message): [cmake] The imported target "Qt6::EntryPointImplementation" references the file [cmake] [cmake] "D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/Qt6EntryPointd.lib" [cmake] [cmake] but this file does not exist. Possible reasons include: [cmake] [cmake] * The file was deleted, renamed, or moved to another location. [cmake] [cmake] * An install or uninstall procedure did not complete successfully. [cmake] [cmake] * The installation package was faulty and contained [cmake] [cmake] "D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6EntryPointPrivate/Qt6EntryPointPrivateTargets.cmake" [cmake] [cmake] but not all the files it references. [cmake] [cmake] Call Stack (most recent call first): [cmake] D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6EntryPointPrivate/Qt6EntryPointPrivateConfig.cmake:52 (include) [cmake] D:/Programming/CMake/share/cmake-3.27/Modules/CMakeFindDependencyMacro.cmake:76 (find_package) [cmake] D:/Programming/Qt_Designer/6.5.2/msvc2019_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:111 (find_dependency) [cmake] D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Core/Qt6CoreDependencies.cmake:39 (_qt_internal_find_qt_dependencies) [cmake] D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Core/Qt6CoreConfig.cmake:40 (include) [cmake] D:/Programming/CMake/share/cmake-3.27/Modules/CMakeFindDependencyMacro.cmake:76 (find_package) [cmake] D:/Programming/Qt_Designer/6.5.2/msvc2019_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:111 (find_dependency) [cmake] D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Gui/Qt6GuiDependencies.cmake:39 (_qt_internal_find_qt_dependencies) [cmake] D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:40 (include) [cmake] D:/Programming/Qt_Designer/6.5.2/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package) [cmake] CMakeLists.txt:8 (find_package) [cmake] -- Configuring incomplete, errors occurred! [cmake] [cmake] [cmake] CMake Warning at D:/Programming/CMake/share/cmake-3.27/Modules/CMakeFindDependencyMacro.cmake:76 (find_package): [cmake] Found package configuration file: [cmake] [cmake] D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Core/Qt6CoreConfig.cmake [cmake] [cmake] but it set Qt6Core_FOUND to FALSE so package "Qt6Core" is considered to be [cmake] NOT FOUND. [cmake] Call Stack (most recent call first): [cmake] D:/Programming/Qt_Designer/6.5.2/msvc2019_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:111 (find_dependency) [cmake] D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Gui/Qt6GuiDependencies.cmake:39 (_qt_internal_find_qt_dependencies) [cmake] D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:40 (include) [cmake] D:/Programming/Qt_Designer/6.5.2/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package) [cmake] CMakeLists.txt:8 (find_package) [cmake] [cmake] [cmake] CMake Warning at D:/Programming/Qt_Designer/6.5.2/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package): [cmake] Found package configuration file: [cmake] [cmake] D:/Programming/Qt_Designer/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake [cmake] [cmake] but it set Qt6Gui_FOUND to FALSE so package "Qt6Gui" is considered to be [cmake] NOT FOUND. [cmake] Call Stack (most recent call first): [cmake] CMakeLists.txt:8 (find_package) [cmake] [cmake] [proc] The command: D:\Programming\CMake\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_PREFIX_PATH:STRING=D:/Programming/Qt_Designer/6.5.2/msvc2019_64 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\mingw64\bin\g++.exe -SC:/Users/YuriiButNotYuri/Desktop/japanese_app_v2/qt_gui/Japanese_app_v20_gui -Bc:/Users/YuriiButNotYuri/Desktop/japanese_app_v2/build -G "MinGW Makefiles" exited with code: 1
-
After I reinstalled Qt in a different directory and added
set(CMAKE_PREFIX_PATH "D:/Qt/6.5.1/msvc2019_64")
to the CMakeLists.txt file, it started compiling. Output:[main] Configuring project: japanese_app_v2 [proc] Executing command: D:\Programming\CMake\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_PREFIX_PATH:STRING=D:/Programming/Qt_Designer/6.5.1/msvc2019_64 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\mingw64\bin\g++.exe -SC:/Users/YuriiButNotYuri/Desktop/japanese_app_v2/qt_gui/Japanese_app_v20_gui -Bc:/Users/YuriiButNotYuri/Desktop/japanese_app_v2/build -G "MinGW Makefiles" [cmake] Not searching for unused variables given on the command line. [cmake] -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) [cmake] -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) [cmake] CMake Warning (dev) at D:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:2690 (message): [cmake] Qt policy QTP0001 is not set: ':/qt/qml/' is the default resource prefix [cmake] for QML modules. Check https://doc.qt.io/qt-6/qt-cmake-policy-qtp0001.html [cmake] for policy details. Use the qt_policy command to set the policy and [cmake] suppress this warning. [cmake] [cmake] Call Stack (most recent call first): [cmake] D:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:445 (__qt_internal_setup_policy) [cmake] qmlmodules:4 (qt6_add_qml_module) [cmake] CMakeLists.txt:26 (include) [cmake] This warning is for project developers. Use -Wno-dev to suppress it. [cmake] [cmake] CMake Warning (dev) at D:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:2690 (message): [cmake] Qt policy QTP0001 is not set: ':/qt/qml/' is the default resource prefix [cmake] for QML modules. Check https://doc.qt.io/qt-6/qt-cmake-policy-qtp0001.html [cmake] for policy details. Use the qt_policy command to set the policy and [cmake] suppress this warning. [cmake] [cmake] Call Stack (most recent call first): [cmake] D:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:445 (__qt_internal_setup_policy) [cmake] content/CMakeLists.txt:7 (qt6_add_qml_module) [cmake] This warning is for project developers. Use -Wno-dev to suppress it. [cmake] [cmake] CMake Warning (dev) at D:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:2690 (message): [cmake] Qt policy QTP0001 is not set: ':/qt/qml/' is the default resource prefix [cmake] for QML modules. Check https://doc.qt.io/qt-6/qt-cmake-policy-qtp0001.html [cmake] for policy details. Use the qt_policy command to set the policy and [cmake] suppress this warning. [cmake] [cmake] Call Stack (most recent call first): [cmake] D:/Qt/6.5.1/msvc2019_64/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:445 (__qt_internal_setup_policy) [cmake] imports/Japanese_app_v20_gui/CMakeLists.txt:12 (qt6_add_qml_module) [cmake] This warning is for project developers. Use -Wno-dev to suppress it. [cmake] [cmake] -- Configuring done (0.7s) [cmake] -- Generating done (0.5s) [cmake] -- Build files have been written to: C:/Users/YuriiButNotYuri/Desktop/japanese_app_v2/build
However, I encountered another issue when trying to compile main.cpp
-
@jsulm this is what Qt Creator shows
07:59:42: Starting C:\Users\YuriiButNotYuri\Desktop\japanese_app_v2\qt_gui\build-Japanese_app_v20_gui-Desktop_Qt_6_5_1_MSVC2019_64bit-Debug\Japanese_app_v20_guiApp.exe... QML debugging is enabled. Only use this in a safe environment. QQmlApplicationEngine failed to load component qrc:Main/main.qml:4:1: Type App unavailable qrc:/content/App.qml:14:5: Type Screen01 unavailable qrc:/content/Screen01.ui.qml: Type Constants unavailable qrc:/Japanese_app_v20_gui/Constants.qml:3:1: module "QtQuick.Studio.Application" is not installed 07:59:43: C:\Users\YuriiButNotYuri\Desktop\japanese_app_v2\qt_gui\build-Japanese_app_v20_gui-Desktop_Qt_6_5_1_MSVC2019_64bit-Debug\Japanese_app_v20_guiApp.exe exited with code -1
-
@jsulm I used to believe that the only way to create a C++ GUI was through Qt Design Studio, as I had never created anything in C++ other than console programs. I've created a GUI in Python in the past with it. However, I stumbled upon examples in Qt Creator that use .ui files. I'm familiar with this approach, having worked with UI and widgets before. I believe I'll continue using widgets since they don't show any errors when the program is executed.
I will close this conversation as I no longer require assistance with qml. If I encounter any further issues, I'll post on a forum if I'm unable to resolve them myself. Thank you to everyone who tried to help me. -