Example 4.3 can't compile

#include <ros/ros.h>
#include <std_msgs/Int32.h>
void counterCallback(const std_msgs::Int32::ConstPtr& msg)
{
ROS_INFO("%d", msg->data);
}
int main(int argc, char** argv) {
ros::init(argc, argv, “topic_subscriber”);
ros::NodeHandle nh;
ros::Subscriber sub = nh.subscribe(“counter”, 1000, counterCallback);
ros::spin();
return 0;
}

ERROR:


Please help me :((

your code doesn’t give me that error it gives a cotation error with your “ i change then for " and it works

2 Likes

This topic was automatically closed after 3 days. New replies are no longer allowed.