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

IDE development and code completion for messages

asked 2012-07-06 10:37:48 -0600

PerkinsJames gravatar image

updated 2014-01-28 17:12:56 -0600

ngrennan gravatar image

When I create a .msg file and then build my package using rosmake, it places the generated header file in package_name/msg_gen/cpp/include/...

However, when I include that header file in my program, ROS allows me to use

#include "package_name/messageexample.h"

The issue here is that an IDE (Eclipse, in my case) uses that include line to properly perform its code completion functions. Since that path is not an actual path, it doesn't work. Setting the proper include directories to the FULL path (msg_gen folder) above does not allow code completion to work properly either. The only solution (hack) I found, which is not good, is to do a #include of the FULL path right after the proper ROS format include.

Are there any solutions or better workarounds to this issue that anyone has found?

Update (not enough room in a comment): I have tried @AHornung answer using the tutorials on that page, but the command

rosmake --target=eclipse-project --specified-only *

does not work, providing the error:

WARNING: The following args could not be parsed as stacks or packages: ['CMakeLists.txt', 'include', 'mainpage.dox', 'Makefile', 'manifest.xml', 'src'] [ rosmake ] ERROR: No arguments could be parsed into valid package or stack names.

I have included the path to my package in ROS_PACKAGE_PATH and can correctly roscd to it. Running the same command without the --specified-only does produce the proper eclipse project files, but the same issue I originally had with the generated messages is still there.

Any thoughts? I am using Fuerte with Eclipse Juno.


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-07-06 10:56:27 -0600

AHornung gravatar image

Did you run "make eclipse-project" and imported the project like described in ? That should set up all the paths for Eclipse to look into with its indexer, not only generated headers but also system-installed packages and libraries.

edit flag offensive delete link more


@AHornung That's interesting. I have never seen that page before and still can't seem to find where its linked from on the ROS wiki. Is it linked anywhere? Is there a way to see on a wiki page what links to it? I'll checkmark your answer if it works after I try it out...Thanks.

PerkinsJames gravatar image PerkinsJames  ( 2012-07-06 11:32:04 -0600 )edit

@PerkinsJames: have you tried make eclipse-project in your package directory (as @AHornung suggests). I've never used the rosmake --target=eclipse-project --specified-only. Be sure to close+re-open / delete+reimport your project after changes to CMakeLists.txt (and rerun make eclipse-project).

ipso gravatar image ipso  ( 2012-07-21 00:59:58 -0600 )edit

Thanks to @AHornung and @ipso for the help. The problem was because of a mistake I made not placing the package where the messages were defined as a dependency of the package I was trying to bring into eclipse (inside the package's manifest.xml file) before running make eclipse-project.

PerkinsJames gravatar image PerkinsJames  ( 2012-07-23 07:45:54 -0600 )edit

answered 2012-07-21 00:21:21 -0600

I can recommend QtCreator as an IDE, as it can directly open the CMakeLists.txt of ROS packages and works out of the box (with code completion) without any preceding setup steps. See here for more info.

edit flag offensive delete link more


I will be trying this out.

PerkinsJames gravatar image PerkinsJames  ( 2012-07-23 07:46:47 -0600 )edit

Question Tools


Asked: 2012-07-06 10:37:48 -0600

Seen: 680 times

Last updated: Jul 21 '12