ROS ERROR:‘tf2_buffer_’ was not declared in this scope
I copy the code of Autolabor2.5 in my workspace, and when I start to build, I get an error that says "error: ‘tf2_buffer_’ was not declared in this scope"
The error is in /home/hwh/catkin_ws/src/navigation/amcl/src/amcl_node.cpp, and here is the code where error happens
// Use a child class to get access to tf2::Buffer class inside of tf_
struct TransformListenerWrapper : public tf::TransformListener
{
inline tf2_ros::Buffer &getBuffer() {return tf2_buffer_;}
};
The whole code is too long, so I do not put the file for now.
You tagged
melodic
and yet the code you show is from the branchkinetic
(source), which ros distribution do you have ? Instead of getting the source code in your workspace why don't you get the packageamcl
withsudo apt install ros-DISTRO-amcl
?My distribution is melodic, and I just copy the code from a robot official website. By the way, how do you find the distribution of the code?
Besides, I hope to study the code
On github for example, you can see at the top of the file the name of the current branch (you can also find it in the url) which generally contains the ros distribution.
Maybe the link can be helpful here. And anyway even if it's from an official source you can change the branch (thus the distribution) so if your link wasn't pointing to the default branch (for
amcl
it'smelodic
) you don't get the correct version.thanks, I will give it a try