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

error: 'Point' does not name a type

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

Dominati gravatar image

Hi,

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.

Cmakelists.txt: http://imgur.com/a/CF2hb

package.xml: http://imgur.com/a/PTQzD

visual_servoing.cpp: http://imgur.com/a/N90cB

edit retag flag offensive close merge delete

Comments

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

http://imgur.com/a/Uk4HQ

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

1 Answer

Sort by » oldest newest most voted
1

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

2 followers

Stats

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

Seen: 5,178 times

Last updated: Jun 11 '17