What exactly is causing this error whne compiling the node ?
I am trying to write a simple node that responds with a message when an image from camera is received. I have specific node provided by the ROS for this camera to open it and other to request the data. Now i want to write a simple subscriber that is subscribed to the topic that is being published by the request data node and i want my node to simple acknowledge the image received with a simple message.
Here is the code for my simple node
void imageCallback(const sensor_msgs::ImageConstPtr& msg){
ROS_INFO("I heard the image");
}
int main(int argc, char **argv){
ros::init(argc, argv, "test_node_vision");
ros::NodeHandle nh;
ros::Subscriber sub = nh.subscribe("image_listener", 1000, imageCallback);
ros::spin();
return 0;
}
when trying to ros run this node, there is a syntax error with '(' token near the line where i am defining the imageCallback function. But to me all the syntax looks correct and hence I suspect there is something somewhere else going wrong with this node which then caused a domino effect ended up with this error. Can anyone please help me with this. Thank you.
Here is the error
/home/sganapa/catkin_ws/src/montage-anwendung/montage_roboter/src/ensenso_tutorial.cpp: line 10: syntax error near unexpected token `('
/home/sganapa/catkin_ws/src/montage-anwendung/montage_roboter/src/ensenso_tutorial.cpp: line 10: `void imageCallback(const sensor_msgs::ImageConstPtr& msg){'
No one will be able to help you unless you show the error message you received.
Here I have added the error. As said, it says syntax error.
It's likely there are other errors before this one.