Undefined reference to tf2::fromMsg
In this code:
visualization_msgs::Marker marker_msg;
geometry_msgs::TransformStamped geo_tf_stamped;
tf2::Stamped<tf2::Transform> tf2_stamped;
geo_tf_stamped = tf_buffer.lookupTransform("map", "camera_image", bboxes_msg->header.stamp, ros::Duration(1.0));
tf2::convert(geo_tf_stamped.transform, tf2_stamped);
tf2::toMsg(tf2_stamped, marker_msg.pose);
My linker can't find a tf2::fromMsg
implementation:
In function `void tf2::impl::Converter<true, false>::convert<geometry_msgs::Transform_<std::allocator<void> >, tf2::Stamped<tf2::Transform> >(geometry_msgs::Transform_<std::allocator<void> > const&, tf2::Stamped<tf2::Transform>&)':
[...]
undefined reference to `void tf2::fromMsg<geometry_msgs::Transform_<std::allocator<void> >, tf2::Stamped<tf2::Transform> >(geometry_msgs::Transform_<std::allocator<void> > const&, tf2::Stamped<tf2::Transform>&)'
In my CMakeLists.txt I already have these packages:
find_package(catkin REQUIRED COMPONENTS
roscpp
vision_inference
vision_inference_msgs
visualization_msgs
geometry_msgs
tf2_geometry_msgs
tf2_ros
tf2
tf
)
Which package do i need to add to get the tf2::fromMsg linked? Or am I doing something else wrong?
I'm using
ROS Kinetic
and if I runls /opt/ros/kinetic/lib/libtf*
I have the following files:libtf2_ros.so, libtf2.so, libtf_conversions.so, libtf.so
.What is your output if you run the same command considering the path of your ROS Version?
same:
/opt/ros/lunar/lib/libtf2_ros.so
,/opt/ros/lunar/lib/libtf_conversions.so
,/opt/ros/lunar/lib/libtf2.so
,/opt/ros/lunar/lib/libtf.so
.I have the same problem with indigo. I included
<tf2_geometry_msgs/tf2_geometry_msgs.h>
, addedtf2_geometry_msgs
topackage.xml
andCMakeLists.txt
, and compile with catkin-tools. Could this be related to using C++11 standard?Hello, same problem, my shell complaint :
/home/user/workspace/devel/lib/libmoveit_ros_benchmarks.so.0.9.11: undefined reference to
void tf2::fromMsg<geometry_msgs::quaternion_<std::allocator<void> >, tf2::Quaternion>(geometry_msgs::Quaternion_<std::allocator<void> > const&, tf2::Quaternion&)' `