小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
qt5实验失败
-
在虚拟机上按照书上的步骤做的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()
-
@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
-
@小鱼是在vscode运行的,vscode是安装完系统进入之后推荐安装的,现在发现通过Ubuntu软件安装的凑code无法通过命令卸载,也没有code的图标。在Ubuntu里的软件里卸载后,重新安装的code出现的code的图标但是无法通过命令打开