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

‘Publisher’ was not declared in this scope

asked 2017-07-06 23:59:27 -0500

youngee529@gmail.com gravatar image

updated 2017-07-07 01:57:11 -0500

gvdhoorn gravatar image

my source:

#include "ros/ros.h"
#include "oroca_ros_tutorials/msgTutorial.h"


int main(int argc,char **argv)
{
ros::init(argc,argv,"ros_tutorial_msg_publisher");
ros::NodeHandle nh;
ros:Publisher ros_tutorial_pub=nh.advertise<oroca_ros_tutorials::msgTutorial>("ros_tutorial_msg",100);
ros::Rate loop_rate(10);
int count = 0;
while(ros::ok){
oroca_ros_tutorials::msgTutorial msg;
msg.data=count;
ROS_INFO("send msg =%d",count);
ros_tutorial_pub.publish(msg);
loop_rate.sleep();
++count;
}
return 0;
}

I did catkin_make to build ...and..error...came out Error:

 /home/young/catkin_ws/src/oroca_ros_tutorials/src/ros_tutorial_msg_publisher.cpp:9:5: error: ‘Publisher’ was not declared in this scope

why?? Help....

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
4

answered 2017-07-07 00:35:09 -0500

ufr3c_tjc gravatar image

You're missing a second ':' before the word Publisher.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-07-06 23:59:27 -0500

Seen: 4,215 times

Last updated: Jul 07 '17