ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

ros::init not working

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

atenea gravatar image

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

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
    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



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 -0600 )edit

Please reply it as an answer,thank you~

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

1 Answer

Sort by ยป oldest newest most voted

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


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

Seen: 316 times

Last updated: Sep 19 '13