鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    qt5实验失败

    已定时 已固定 已锁定 已移动
    ROS2机器人开发:从入门到实践
    ros2 run qt出错
    2
    3
    309
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 1
      生欢
      最后由 编辑

      在虚拟机上按照书上的步骤做的hello_qt实验是正常的,后面装了双系统之后在新装的系统上无法运行,显示:
      QSocketNotifier: Can only be used with threads started with QThread
      /home/milk/chap3/topic_practice_ws/install/status_display/lib/status_display/hello_qt: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE
      [ros2run]: Process exited with failure 127
      这是hello_qt.cpp中的内容:
      #include <QApplication>
      #include <QLabel>
      #include <QString>

      int main(int argc,char argv[])
      {
      QApplication app(argc,argv);
      QLabel
      label = new QLabel();
      QString message = QString::fromStdString("Hello QT!");
      label->setText(message);
      label->show();
      app.exec(); //执行应用
      return 0;
      }
      这是CMakeLists.txt中的内容:
      cmake_minimum_required(VERSION 3.8)
      project(status_display)

      if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
      add_compile_options(-Wall -Wextra -Wpedantic)
      endif()

      find dependencies

      find_package(ament_cmake REQUIRED)
      find_package(rclcpp REQUIRED)
      find_package(status_interfaces REQUIRED)
      find_package(Qt5 REQUIRED COMPONENTS Widgets)

      add_executable(hello_qt src/hello_qt.cpp)
      target_link_libraries(hello_qt Qt5::Widgets)

      add_executable(sys_status_display src/sys_status_display.cpp)
      target_link_libraries(sys_status_display Qt5::Widgets)

      ament_target_dependencies(sys_status_display rclcpp status_interfaces)

      if(BUILD_TESTING)
      find_package(ament_lint_auto REQUIRED)

      the following line skips the linter which checks for copyrights

      comment the line when a copyright and license is added to all source files

      set(ament_cmake_copyright_FOUND TRUE)

      the following line skips cpplint (only works in a git repo)

      comment the line when this package is in a git repo and when

      a copyright and license is added to all source files

      set(ament_cmake_cpplint_FOUND TRUE)
      ament_lint_auto_find_test_dependencies()
      endif()

      install(TARGETS hello_qt sys_status_display
      DESTINATION lib/${PROJECT_NAME}
      )

      ament_package()

      小鱼小 1 条回复 最后回复 回复 引用 0
      • 小鱼小
        小鱼 技术大佬 @19130540668
        最后由 编辑

        @19130540668 在 qt5实验失败 中说:

        QSocketNotifier: Can only be used with threads started with QThread
        /home/milk/chap3/topic_practice_ws/install/status_display/lib/status_display/hello_qt: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE

        是在vscode中运行的吗?怎么安装的vscode

        新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

        1 1 条回复 最后回复 回复 引用 0
        • 1
          生欢 @小鱼
          最后由 19130540668 编辑

          @小鱼是在vscode运行的,vscode是安装完系统进入之后推荐安装的,现在发现通过Ubuntu软件安装的凑code无法通过命令卸载,也没有code的图标。在Ubuntu里的软件里卸载后,重新安装的code出现的code的图标但是无法通过命令打开

          1 条回复 最后回复 回复 引用 0
          • 第一个帖子
            最后一个帖子
          皖ICP备16016415号-7
          Powered by NodeBB | 鱼香ROS