I'm new to ROS and I stuck in a beginner problem. I already did the ROS Tutorials where I wrote a subscriber but it doesn't explain my problem. I wanna write a simple subscriber in C++ for the kinect (topic => /camera/depth_registered/points). My code looks like the following:
void pcdCallback(const sensor_msgs::PointCloud2ConstPtr& msg) {
ROS_INFO("pointcloud recieved");
}
int main(int argc, char **argv) {
ros::init(argc, argv, "pcdlistener");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("/camera/depth_registered/points", 1000, pcdCallback);
ros::spin();
return 0;
}
My Problem is now that the compiling produces the following failure:
/home/ronny/ros/pkgs/subscriber_pcd/src/pcdsubscriber.cpp:7: error: ISO C++ forbids declaration of ‘sensor_msgs’ with no type
would be great to get a hint or solution.
regards
Originally posted by dinamex on ROS Answers with karma: 447 on 2011-11-29
Post score: 0
Original comments
Comment by Martin Peris on 2011-11-29:
First of all, welcome to ROS! About your question: Did you forget this: #include <sensor_msgs/PointCloud2.h>? it would be helpful for us if you posted the complete code (with #includes and all that). :)