0
$\begingroup$

Rosanswers logo

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.

Thanks!


Originally posted by PerkinsJames on ROS Answers with karma: 506 on 2012-07-06

Post score: 1

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Did you run "make eclipse-project" and imported the project like described in http://www.ros.org/wiki/IDEs#Creating_the_Eclipse_project_files ? 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.


Originally posted by AHornung with karma: 5904 on 2012-07-06

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by PerkinsJames on 2012-07-06:
@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.

Comment by ipso on 2012-07-21:
@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).

Comment by PerkinsJames on 2012-07-23:
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.

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2012-07-21

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by PerkinsJames on 2012-07-23:
I will be trying this out.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.