Running tf2 tutorials on ros occurs unexpected catkin_make faults
Since I compile the workspace I may find the following problems:
/usr/bin/ld: CMakeFiles/static_turtle_tf2_broadcaster.dir/src/static_turtle_tf2_broadcaster.cpp.o: undefined reference to symbol '_ZN3ros4spinEv'
/usr/bin/ld: /opt/ros/noetic/lib/libroscpp.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [learning_tf2/CMakeFiles/static_turtle_tf2_broadcaster.dir/build.make:113:/home/ryan/catkin_ws/devel/lib/learning_tf2/static_turtle_tf2_broadcaster] 错误 1
make[1]: *** [CMakeFiles/Makefile2:1226:learning_tf2/CMakeFiles/static_turtle_tf2_broadcaster.dir/all] 错误 2
make: *** [Makefile:146:all] 错误 2
Invoking "make -j16 -l16" failed
The CMakelist is down below:
cmake_minimum_required(VERSION 3.0.2)
project(learning_tf2)
## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
tf2
tf2_ros
turtlesim
)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES learning_tf2
# CATKIN_DEPENDS roscpp rospy tf2 tf2_ros turtlesim
# DEPENDS system_lib
)
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
add_executable(static_turtle_tf2_broadcaster src/static_turtle_tf2_broadcaster.cpp)
target_link_libraries(static_turtle_tf2_broadcaster ${catkin_LIBRARIES} )
while my env is noetic Ubuntu 20.04 with anaconda and cuda installed. Any solutions are welcomed Thanks.
Asked by ryantysre on 2023-07-11 09:13:17 UTC
Comments