Qt 安装、Qt 配置 ROS 开发环境问题汇总

1、在线安装

借鉴博主:

Linux 系统(Ubuntu)下安装 Qt 环境

补充:在线安装选择版本如果没有想要的 Qt 版本,勾选旁边的archive,其他取消勾选,点filter。

或者寻找历史版本:http://www.ffmpeg.club/qt
上面有Qt 5.9 长期支持版!!!

2、问题1:在线安装完后,运行 qtcreator 报错:

Fron 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platforn plugin.
Could not load the Qt platforn plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platforn plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: vnc, linuxfb, eglfs, wayland-egl, mininal, minimalegl, xcb, vkkhrdisplay, wayland, offscreen.

解决方法:少安装了某些库

借鉴:Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

比如我的出现如下问题:

qt.core.library: "/home/yin-roc/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so"
 cannot load: Cannot load library /home/yin-roc/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so: 
 (libxcb-cursor.so.0: 无法打开共享对象文件: 没有那个文件或目录)

解决方法:

sudo apt-get install libxcb-cursor0

3、Qt 配置 ROS 开发环境见下文

Qt 配置 ROS 开发环境 推荐使用该博主推荐的方法。

4、Qt下创建 ros 工作空间,新建 ros 包后无法看到 src文件

解决方法:
Qt ros开发环境中,添加包后无法显示src文件夹的问题解决

5、问题2:在 Qt Creator 上创建 ROS 项目并新建/导入 ROS 包执行 catkin_make 报错

➜  catkin_qt_ws catkin_make
Base path: /home/yin-roc/workspace/catkin_qt_ws
Source space: /home/yin-roc/workspace/catkin_qt_ws/src
Build space: /home/yin-roc/workspace/catkin_qt_ws/build
The build space at '/home/yin-roc/workspace/catkin_qt_ws/build' was previously built by 'catkin build'. Please remove the build space or pick a different build space.

解决办法:删除原先编译产生的 build 和 devel,并手动编译:
https://blog.csdn.net/weixin_45813121/article/details/132010422

6、问题3:重新编译时,使用 catkin_make 报错

Errors     << qviz_demo:cmake /home/yin-roc/workspace/catkin_qt_ws/logs/qviz_demo/build.cmake.003.log
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "rviz" with any of
the following names:

	rvizConfig.cmake
	rviz-config.cmake

Add the installation prefix of "rviz" to CMAKE_PREFIX_PATH or set
"rviz_DIR" to a directory containing one of the above files.  If "rviz"
provides a separate development package or SDK, be sure it has been
installed.

解决办法:ros失效了,重新安装ros。

小鱼的一键安装系列

7、问题4:编译自有工程时,报错:

CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5Multimedia"
  with any of the following names:

    Qt5MultimediaConfig.cmake
    qt5multimedia-config.cmake

  Add the installation prefix of "Qt5Multimedia" to CMAKE_PREFIX_PATH or set
  "Qt5Multimedia_DIR" to a directory containing one of the above files.  If
  "Qt5Multimedia" provides a separate development package or SDK, be sure it
  has been installed.

缺少安装库,执行命令:

sudo apt-get install qtmultimedia5-dev

8、问题5:编译自有工程时,报错:

CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5WebChannel"
  with any of the following names:

    Qt5WebChannelConfig.cmake
    qt5webchannel-config.cmake

  Add the installation prefix of "Qt5WebChannel" to CMAKE_PREFIX_PATH or set
  "Qt5WebChannel_DIR" to a directory containing one of the above files.  If
  "Qt5WebChannel" provides a separate development package or SDK, be sure it
  has been installed.

缺少安装库,执行命令:

sudo apt-get install qtwebengine5-dev

9、问题6:编译自有工程时,报错:

CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5SerialPort"
  with any of the following names:

    Qt5SerialPortConfig.cmake
    qt5serialport-config.cmake

  Add the installation prefix of "Qt5SerialPort" to CMAKE_PREFIX_PATH or set
  "Qt5SerialPort_DIR" to a directory containing one of the above files.  If
  "Qt5SerialPort" provides a separate development package or SDK, be sure it
  has been installed.

缺少库支持,执行命令:

sudo apt install libqt5serialport5-dev


10、问题7:导入外部工程时报错:

the following names:    Qt6Config.cmake   qt6-config.cmake   Qt5Config.cmake   qt5-
config.cmake  Add the installation prefix of &quot;QT&quot; to CMAKE_PREFIX_PATH or
 set &quot;QT_DIR&quot; to a directory containing one of the above files.  If 
 &quot;QT&quot; provides a separate development package or SDK, be sure it has been 
 installed.

功能包下的 CMakeLists 加入如下语句:

set(CMAKE_PREFIX_PATH "/home/yin-roc/Qt/6.6.2/gcc_64")

11、问题8:导入外部工程报错:

/home/yin-roc/1-Github/workspace/qt_ros_ws/catkin_ws_1/src/ros_qt_test/CMakeLists.txt:31: error: By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "catkin", but
CMake did not find one.

Could not find a package configuration file provided by "catkin" with any
of the following names:

  catkinConfig.cmake
  catkin-config.cmake

Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
"catkin_DIR" to a directory containing one of the above files.  If "catkin"
provides a separate development package or SDK, be sure it has been
installed.

还有的类似报错:roscpp等
建议重装一下qt(不要只是单纯测试小乌龟节点)!

12、卸载 Qt

按照对应的版本选择命令:

sudo apt-get remove qt5*
sudo apt-get remove qt4*
sudo apt-get remove qt6*```

13、Ubuntu内部有多个qmake版本

Ubuntu16.04修改Linux系统默认Qt版本号,使用qtchooser工具方法,不修改配置文件

  • 11
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值