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

ros::init not working

asked 2013-09-19 03:34:36 -0500

atenea gravatar image

updated 2013-09-19 18:58:41 -0500

Hi everyone!

I am having a bit of a problem with my code. I want to write a simple node but I am getting the error "undefined reference to ros::init(....)"

My code looks somethins like this:

class Bridge
{
private:
    ros::NodeHandle nh_;

};

int main(int argc, char** argv) {

    ros::init(argc, argv, "bridge");
    Bridge bridge;
};

Any idea why is this happening?

Thanks in advance

edit retag flag offensive close merge delete

Comments

1

Please update your question with more information, i.e. show the contents of your CMakeLists.txt file etc. Also what ROS version are you using?

Boris gravatar image Boris  ( 2013-09-19 03:45:53 -0500 )edit
1

Please reply it as an answer,thank you~

sam gravatar image sam  ( 2013-09-19 07:41:46 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-09-19 04:51:34 -0500

atenea gravatar image

Thanks for your comment Boris. I checked my CMakeLists.txt file and noticed that I didn't have rosbuild_init() in it. I added it and now it works.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-09-19 03:34:36 -0500

Seen: 398 times

Last updated: Sep 19 '13