[ROS2] tf2::fromMsg linker error

asked 2020-09-18 05:17:47 -0500

Myzhar gravatar image

Hi all, I'm getting a weird linker error using tf2::fromMsg function in ROS2 Eloquent.

tf2::Transform mSensor2BaseTransf;
[...]

// Save the transformation
geometry_msgs::msg::TransformStamped s2b =
        mTfBuffer->lookupTransform(mDepthFrameId, mBaseFrameId, rclcpp::Time(0), rclcpp::Duration(0.1));
// Get the TF2 transformation
tf2::fromMsg(s2b.transform, mSensor2BaseTransf);

This code is used inside a Component library that compiles without any problem, but when I create a C++ Container that load the component I get the following error:

undefined reference to `void tf2::fromMsg<geometry_msgs::msg::Transform_<std::allocator<void> >, tf2::Transform>(geometry_msgs::msg::Transform_<std::allocator<void> > const&, tf2::Transform&)'

Any idea about how to solve the problem?

Thank you Walter collect2: error: ld returned 1 exit status

edit retag flag offensive close merge delete