ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

error: 'Point' does not name a type

asked 2017-06-11 20:12:32 -0600

Dominati gravatar image


I'm trying to utilize the geometry_msgs 'Point' type and receiving this error:

/home/viki/catkin_ws/src/ibvs/src/visual_servoing.cpp:42:1: error: ‘Point’ does not name a type Point CENTER = Point(WIDTH/2, HEIGHT/2); ^

I'm assuming its something to do with my Cmakelists.txt or package.xml, as I've specified the include.




edit retag flag offensive close merge delete


I've also tried an alternate syntax, which still returns a similar error (see image link below).

Dominati gravatar image Dominati  ( 2017-06-11 20:44:39 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-06-11 21:25:23 -0600

ahendrix gravatar image

Looks like there are a few problems here:

  • The Point class is in the geometry_msgs namespace, so you should use the fully-namespaced class type: geometry_msgs::Point
  • ROS message types (such as point) only have default constructors, so you have to construct the object before you can fill in its fields.
  • You cannot have code outside of a function or class in C++ (as in your second try)

P.S. - for future questions please use the "preformatted text" button and paste your code and error messages directly into the question.

edit flag offensive delete link more

Question Tools



Asked: 2017-06-11 20:07:10 -0600

Seen: 4,738 times

Last updated: Jun 11 '17