I'm using ROS melodic.
This is not a robot problem, it is a C++ problem.
I'm trying this C++ code:
#include "ros/ros.h"
#include "geometry_msgs/Point.h"
#include "geometry_msgs/Twist.h"
#include "geometry_msgs/Quaternion.h"
#include "tf/transform_datatypes.h"
#include "tf/LinearMath/Matrix3x3.h"
#include "nav_msgs/Odometry.h"
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <queue>
// ... More code
geometry_msgs::Point p;
But I get the following error message:
no instance of constructor "geometry_msgs::Point_<containerallocator>::Point_ [with ContainerAllocator=std::allocator<void>]" matches the argument list -- argument types are: (double, double)
This is Point.h header.
What am I doing wrong?
Check if you have added the geometry_msgs
in your package.xml
and CMakeLists.txt
. If not then just add it.
In package.xml add:
<depend>geometry_msgs</depend>
In CMakeLists.txt add:
find_package(catkin REQUIRED COMPONENTS
geometry_msgs
)
catkin_package(
CATKIN_DEPENDS geometry_msgs
)