Ubuntu 22.04 下配置 Qt Creator 6.6 环境

1. Qt 简介

Qt 源文件网址
Index of /archive/qt

2. 安装 Qt Creator

cd 到安装包所在目录,进行软件安装。赋予可执行权限,加上 sudo 权限进入安装,这样会安装在/opt 目录下。

1.到官方网站下载:

wget https://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run

2.修改文件权限:

chmod +x ./qt-unified-linux-x64-online.run

3.运行安装程序:

./qt-unified-linux-x64-online.run

4.登录Qt账号,按照提示步骤进行安装。 

笔者在ubuntu下安装时,遇到Qt账号登录问题。用梯子后才正常登录Qt账号。

 终端内执行:

sudo apt-get update
sudo apt-get install libxcb-cursor0

3. 在 Qt 中打开 CMake 项目

为了成功打开CMake项目,你需要确保在你的系统上已经安装了CMake,并能够在终端或命令提示符中使用cmake命令。另外,确保你在Qt Creator的设置中配置了正确的CMake路径。这样,Qt Creator才能正常识别和使用CMake项目。Qt打开 CMake项目可以按照以下步骤操作:
1. 在Qt Creator中,点击"打开项目"。

2. 导航到CMake项目的根目录。

3. 在根目录中,你应该可以找到一个CMakeLists.txt文件,它是CMake项目的主要配置文件。选择这个文件并点击"打开"。

4. Qt Creator将会检测到CMake项目并加载它。

5. 在左侧的"项目"窗口中,你可以看到项目的源文件、头文件和其他资源。

6. 进行任何必要的配置或修改,比如选择构建目标、设置构建选项等。

7. 点击"构建"按钮,开始构建你的项目。

Edit - preference 里查看 CMake 相关配置:

3.1 打开 CMake项目遇到的问题

/home/coco/myProjects/btl_ros_project/src/pkg_simulator_main_ui/CMakeLists.txt:49: error: By not providing "Findament_cmake.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "ament_cmake", but CMake did not find one. Could not find a package configuration file provided by "ament_cmake" with any of the following names: ament_cmakeConfig.cmake ament_cmake-config.cmake Add the installation prefix of "ament_cmake" to CMAKE_PREFIX_PATH or set "ament_cmake_DIR" to a directory containing one of the above files. If "ament_cmake" provides a separate development package or SDK, be sure it has been installed.  

 在CMakeLists文件中,指定 ament_cmake 地址:

set(CMAKE_PREFIX_PATH "/opt/ros/foxy;${CMAKE_PREFIX_PATH}")

set(ament_cmake_DIR "/opt/ros/foxy/share/ament_cmake/cmake")
find_package(ament_cmake REQUIRED)

 

4. 安装 Qt 遇到的问题

from 6.5.0 xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin. 

这个错误信息表明 Qt 需要 xcb-cursor0libxcb-cursor0 库来加载其 X11 显示平台插件,但是这个库在系统上没有找到。xcb-cursor 是 X 窗口系统(X11)的客户端接口库的一部分,用于处理光标。

要解决这个问题,你需要安装 libxcb-cursor0 包。在 Ubuntu 或基于 Debian 的系统上,你可以使用以下命令来安装它:

sudo apt update

sudo apt install libxcb-cursor0

安装完成后,Qt 应该能够找到所需的库并加载 xcb 平台插件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值