How to create a header declaration for the following function

asked 2013-10-30 08:35:51 -0500

JP gravatar image

Hi everyone,

I am trying to separate the main and the class into a .cpp and .h file from the cv_bridge tutorial code provided here: link:text

When I type:

void imageCallback(const sensor_msgs::ImageConstPtr& original_image);

in my .h file, I get the following compile error:

/home/jay/fuerte/sandbox/ucl_drone/src/imagestream/../header/webcam.h:7:26: error: ‘sensor_msgs’ does not name a type
/home/jay/fuerte/sandbox/ucl_drone/src/imagestream/../header/webcam.h:7:53: error: expected unqualified-id before ‘original_image’
/home/jay/fuerte/sandbox/ucl_drone/src/imagestream/../header/webcam.h:7:53: error: expected ‘)’ before ‘original_image’
/home/jay/fuerte/sandbox/ucl_drone/src/imagestream/../header/webcam.h:7:39: error: expected ‘;’ at end of member declaration
/home/jay/fuerte/sandbox/ucl_drone/src/imagestream/../header/webcam.h:7:53: error: ‘original_image’ does not name a type

Usually this works but perhaps the syntax should be different when using the :: ? Thanks.

edit retag flag offensive close merge delete

Comments

Where do you include the ROS headers?

jdorich gravatar image jdorich  ( 2013-10-30 10:24:39 -0500 )edit

I have a folder called 'header' within my workspace and I add the .cpp file to my CMakeLists.txt file

JP gravatar image JP  ( 2013-10-30 11:35:10 -0500 )edit
1

Sorry, I meant the " #include <ros ros.h="">" and those

jdorich gravatar image jdorich  ( 2013-10-30 11:55:44 -0500 )edit

I had them in the main. I just put them in the .h file where they should have been. Thanks for the help!

JP gravatar image JP  ( 2013-10-30 14:02:41 -0500 )edit