Month: June 2012

Eclipse Unresolved Imports with ROS on Ubuntu

I use Eclipse as an IDE. I do this to get code completion and syntax highlighting, as it does those pretty well for C/C++. Recently, I was trying to write a ROS plugin, and Eclipse couldn’t find the ros.h header file, which I had included with the line #include "ros/ros.h". Because of this, it marked every line where there was any use of anything from that header as an error, and gave a warning on the include line. They were not errors, and the code still built fine, but the IDE displayed it wrong. To fix this, I tried the normal solution, which is:

Click Project -> Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C++ and then use the Add button to add the path to the include file. After that, reindex the project by right-clicking on the project, clicking Index -> Rebuild, and the include should be resolved.

Unfortunately, it wasn’t. Restarting Eclipse didn’t pick it up.

These instructions suggested that it might be something wrong with my language settings, but that doesn’t work either.

This is the proper way of doing it, and it actually works.

Now my tools are out of the way and I can start work. At 5:00PM on Friday.