背景:
当前的QT环境为5.14,qt6对3D等特效支持更好,于是打算升级到QT6。 第一次安装使用在线安装方式,无奈启动之后,界面中文显示乱码,调了半天没搞定。于是决定安装qt-creator12搭配使用qt6。
步骤
第一步: 下载 qt-unified-linux-x64-online.run
执行安装 ./qt-unified-linux-x64-online.run
之后到安装界面的时候,将QT creator 的勾选去掉,仅勾选Qt,一路“下一步”,等待安装完成。
第二步:
当前只是安装好了QT,打开QT creator,使用QT6的工程编译,依然会报错。需要配置编译套件kits
cmake] Running /usr/bin/cmake -S /home/topeet/QT/byd/BYD -B /home/topeet/QT/byd/build-BYD-Desktop_Qt_GCC_64bit-Debug in /home/topeet/QT/byd/build-BYD-Desktop_Qt_GCC_64bit-Debug.
[cmake] CMake Error at CMakeLists.txt:7 (find_package):
[cmake] By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
[cmake] asked CMake to find a package configuration file provided by "Qt6", but
[cmake] CMake did not find one.
[cmake]
[cmake] Could not find a package configuration file provided by "Qt6" (requested
[cmake] version 6.5) with any of the following names:
[cmake]
[cmake] Qt6Config.cmake
[cmake] qt6-config.cmake
[cmake]
[cmake] Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
[cmake] to a directory containing one of the above files. If "Qt6" provides a
[cmake] separate development package or SDK, be sure it has been installed.
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/home/topeet/QT/byd/build-BYD-Desktop_Qt_GCC_64bit-Debug/CMakeFiles/CMakeOutput.log".
[cmake]
[cmake] CMake process exited with exit code 1.
[cmake]
[cmake] Elapsed time: 00:00.
根据提示,配置 CMAKE_PREFIX_PATH
仍然报错,
修改CMakeLists.
set(Qt6_DIR "/home/topeet/qt-creator/qt6_install/6.8.0/gcc_64/lib/cmake/Qt6")
set(CMAKE_PREFIX_PATH "/home/topeet/qt-creator/qt6_install/6.8.0/gcc_64")
编译通过。
编译套件的详细配置如下: