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

Arduino IDE compile error "...undefined reference to `ros::normalizeSecNSec(unsigned long&..."

asked 2012-05-16 18:36:10 -0500

RyanG gravatar image

updated 2014-01-28 17:12:21 -0500

ngrennan gravatar image

When I compile the "Hello World" example in the Arduino IDE I get this message:

HelloWorld.cpp.o: In function global constructors keyed to nh': HelloWorld.cpp:31: undefined reference toros::normalizeSecNSec(unsigned long&, unsigned long&)' collect2: ld returned 1 exit status

I arrived at this point after painstakingly editing the code of every file in the relevant sequence so that every #include "(some_file_name)" reference contained the full directory address to fix "No such file or directory" error messages. So:




And it seemed to be working (at least it stopped throwing up those error messages) but I can't figure this error out. I'm stuck. Any help would be greatly appreciated.

Thanks for the input, Cody. I've mirrored the formatting as it is in the files and it seems to have worked. Those errors looked a bit like this"

HelloWorld.cpp:7:29: fatal error: std_msgs/String.h: No such file or directory compilation terminated.

This one is a bit different as it refers to a line of code directly in the "Hello World".pde file. Following the same tactic as before I modified it from:

include <std_msgs strings.h="">


include </home>

When I do this the compiler posts the error message I listed right at the top of my post. I don't know if this means I fixed that problem and am on to the next, or if the modification caused this error. I'm wondering if the IDE can't locate everything in my sketchbook for some reason. I assume I messed up something on the setup but I had no errors there that I could tell and the IDE sees the ros example files just fine, they're listed in its menus. Either way I'm still stuck.

edit retag flag offensive close merge delete


Can you post all of the errors and warnings you get? I expect if the change in #include "ros/msg.h" changes things, we'll see some other items. Also, if you want code to format properly, wrap it in backticks or indent it with 4 spaces.

Cody gravatar image Cody  ( 2012-05-16 18:41:25 -0500 )edit

Thanks, Cody. I've updated my post. The forum's displaying the code lines all screwy and I can't change it. No idea why. They should look like this. #include <std_msgs strings.h> and #include </home/ryan/sketchbook/libraries/std_msgs/Strings.h>

RyanG gravatar image RyanG  ( 2012-05-17 04:18:30 -0500 )edit

Have there been any updates on the potential root cause? I've tried a bunch of solutions but nothing seems to work.

Bkat gravatar image Bkat  ( 2017-04-25 22:56:14 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-05-17 11:47:22 -0500

RyanG gravatar image

After Third re-install I got it to work. Don't know why though.

edit flag offensive delete link more

Question Tools


Asked: 2012-05-16 18:36:10 -0500

Seen: 6,818 times

Last updated: May 17 '12