Ask Your Question

Rosserial Arduino Compilation Error: No <CSTRING>

asked 2020-09-20 10:05:47 -0500

ytosclee gravatar image

updated 2020-09-20 10:06:53 -0500

Hi, I am using Ubuntu 20.04 and ROS Noetic. I followed the rosserial tutorial arduino setup page but I cannot compile the ros_lib HelloWorld example in Arduino. It gives me the following error. I am not able to resolve it and I would like to ask for your help! Thanks a lot!

    In file included from /home/kk/Arduino/libraries/ros_lib/std_msgs/Time.h:7:0,
                 from /home/kk/Arduino/libraries/ros_lib/ros/node_handle.h:40,
                 from /home/kk/Arduino/libraries/ros_lib/ros.h:38,
                 from /home/kk/Arduino/libraries/ros_lib/examples/HelloWorld/HelloWorld.pde:6:
/home/kk/Arduino/libraries/ros_lib/ros/msg.h:40:10: fatal error: cstring: No such file or directory
 #include <cstring>
compilation terminated.

exit status 1
Error compiling for board Arduino Leonardo.
edit retag flag offensive close merge delete


4 Answers

Sort by ยป oldest newest most voted

answered 2020-09-27 00:09:00 -0500

groscore gravatar image

Hey, I ran into the same issue and after hours of searching google, I found the following workaround:

First you have to delete the ros_lib folder that was created when you initially ran rosrun rosserial_arduino . It should be located in /home/Arduino/libraries or wherever you installed arduino IDE.

Then open the Arduino IDE, in the menu bar go to Tools -> Manage Libraries and search for "rosserial"

You should see Rosserial Arduino Library by Michael Furguson. Install it, I installed 0.7.9

Now you can try to compile your HellowWorld program again and it should work.

Not sure why this worked but hopefully it works for you too.

edit flag offensive delete link more


Thanks, it solves my problem.

ytosclee gravatar image ytosclee  ( 2020-09-30 20:51:04 -0500 )edit

answered 2020-09-28 03:29:37 -0500

Was5K gravatar image

Hi ytoclee

Got same issue here when installing arduino libraries using:

rosrun rosserial_arduino

Just delete the folder 'ros_lib' inside arduino libraries. Then, inside Arduino IDE, Sketch/Include Library/Manage Libraries... search by "rosserial" and install: Rosserial Arduino Library by Michael Ferguson

Using version 0.7.9, worked with fresh new Arduino Uno and Arduino Mega. Also able to compile for Seeeduino Zero (integrated on Odyssey X86J4105)

Let me know if this solves your problem ;)

edit flag offensive delete link more


Thanks, it solves my problem.

ytosclee gravatar image ytosclee  ( 2020-09-30 20:50:29 -0500 )edit

answered 2020-09-25 09:21:31 -0500

Shivantanu gravatar image

Install "StandardCplusplus-master" library in Arduino. Copy 'cstring.c' and 'cstdef.c' from "StandardCplusplus-master" to ros-lib. You can run all code and rosrun rosserial_python /dev/ttyACM0 succesfully without any error.

edit flag offensive delete link more

answered 2020-09-27 17:41:09 -0500

Glyn Webster gravatar image

Hello! I came here looking for the same answer.

The problem is that the ros_lib/ros/msg.h file that ROS puts in the Arduino directory uses <cstring>, the C++ version of <string.h>. Arduino does not recognise that for some reason.

After changing <cstring> to <string.h> and changing all occurances of std::memcpy to just memcpy everything compiled.

That change will disappear next time I update ros_lib, of course, so I'm still keen to know what the right thing to do is.

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



Asked: 2020-09-20 10:05:47 -0500

Seen: 223 times

Last updated: Sep 28