visualization_msgs type support linker error

asked 2019-10-10 21:05:32 -0600

strike_eagle_iii gravatar image

updated 2019-10-11 18:24:57 -0600

I'm trying to learn ros2 (i'm not that familiar with ros 1), specifically rviz2. I'm trying to adapt the basic shapes tutorials here:

http://wiki.ros.org/rviz/Tutorials/Ma...

I've got it compiling, but I get the following linker error:

--- stderr: examples_rclcpp_minimal_rviz                                                                                                                                
CMakeFiles/send_shapes.dir/not_composable.cpp.o: In function `rclcpp::Publisher<visualization_msgs::msg::Marker_<std::allocator<void> >, std::allocator<void> >::Publisher(rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rcl_publisher_options_t const&, rclcpp::PublisherEventCallbacks const&, std::shared_ptr<std::allocator<visualization_msgs::msg::Marker_<std::allocator<void> > > > const&)':
not_composable.cpp:(.text._ZN6rclcpp9PublisherIN18visualization_msgs3msg7Marker_ISaIvEEES4_EC2EPNS_15node_interfaces17NodeBaseInterfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERK23rcl_publisher_options_tRKNS_23PublisherEventCallbacksERKSt10shared_ptrISaIS5_EE[_ZN6rclcpp9PublisherIN18visualization_msgs3msg7Marker_ISaIvEEES4_EC5EPNS_15node_interfaces17NodeBaseInterfaceERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERK23rcl_publisher_options_tRKNS_23PublisherEventCallbacksERKSt10shared_ptrISaIS5_EE]+0x26): undefined reference to `rosidl_message_type_support_t const* rosidl_typesupport_cpp::get_message_type_support_handle<visualization_msgs::msg::Marker_<std::allocator<void> > >()'

My CmakeLists.txt contains

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
#find_package(rosidl_default_generators REQUIRED)
#find_package(rosidl_typesupport_cpp REQUIRED)
#find_package(rosidl_typesupport_fastrtps_cpp REQUIRED)
#find_package(rosidl_typesupport_introspection_cpp REQUIRED)
#find_package(rcl_interfaces REQUIRED)

add_executable(send_shapes not_composable.cpp)

ament_target_dependencies(send_shapes 
  rclcpp 
  std_msgs
  vizualization_msgs
#  rosidl_typesupport_introspection_cpp
#  rosidl_default_generators
#  rosidl_typesupport_cpp
#  rosidl_typesupport_fastrtps_cpp
#  rcl_interfaces)
)

install(TARGETS
  send_shapes
  DESTINATION lib/${PROJECT_NAME}
)

I've tried including all of the packages that are currently commented out to no avail. What package do I need to get the type support working?

EDIT: As I was typing this question up, I realized I had misspelled visualization_msgs in the ament_target_dependencies statement. Why didn't that trigger a cmake error message?

edit retag flag offensive close merge delete

Comments

If the name is not a package name which has been found before you should see the following error message: CMake Error at .../ament_target_dependencies.cmake:52 (message): ament_target_dependencies() the passed package name 'vizualization_msgs' was not found before

Dirk Thomas gravatar imageDirk Thomas ( 2019-10-11 23:10:56 -0600 )edit