non-Catkin build: subscriber can't find msg headers (but can find others)

asked 2019-06-03 05:49:50 -0500

Bruno Vieira gravatar image

updated 2019-06-03 09:51:42 -0500

gvdhoorn gravatar image

Dear all,

I'm quite an experienced user of ROS and am used to write ROS applications, however I'm having an issue that I haven't been able to solve yet, and it is really bothering me, I'll explain:

I'm writing a new application, and can successfully have a proper subscriber for the /clock topic working, even though that my IDE claims that #include <rosgraph_msgs/Clock.h> is an unresolved inclusion just like /ros/ros.h as instance.

When I try to include my header for a custom made .msg (tested in other applications already), my IDE claims that it is, as well, an unresolved inclusion. However, in this case it doesn't even let me successfully compile:

ROSTrafGen.h:87:31: error: ‘ros_its_msgs’ does not name a type
     void SensorCallback(const ros_its_msgs::Sensor &msg);
                               ^~~~~~~~~~~~
ROSTrafGen.h:87:52: error: expected unqualified-id before ‘&’ token
     void SensorCallback(const ros_its_msgs::Sensor &msg);
                                                    ^
ROSTrafGen.h:87:52: error: expected ‘)’ before ‘&’ token
ROSTrafGen.h:87:52: error: expected ‘;’ at end of member declaration
ROSTrafGen.h:87:53: error: ‘msg’ does not name a type
     void SensorCallback(const ros_its_msgs::Sensor &msg);

Any idea on why this is happening?

Thanks in advance. Best regards

edit retag flag offensive close merge delete

Comments

even though that my IDE

which IDE?

gvdhoorn gravatar imagegvdhoorn ( 2019-06-03 05:56:23 -0500 )edit

It is an external tool's dedicated IDE, based of on Eclipse...

Bruno Vieira gravatar imageBruno Vieira ( 2019-06-03 07:43:15 -0500 )edit

Have you ever setup the environment for Eclipse to be able to support code completion? Something like this?

gvdhoorn gravatar imagegvdhoorn ( 2019-06-03 07:45:29 -0500 )edit

I didn't. As I said, it's a external (has no ROS dependency) tool that uses a dedicated IDE for its projects building and launching... Already did a similar integration between both frameworks, however, t relied on cmake for compiling purposes. This time, this project is done using Makefile environments. This shouldn't be an issue, since I already tested some subscriptions (i.e /clock) under this environment

Bruno Vieira gravatar imageBruno Vieira ( 2019-06-03 08:44:42 -0500 )edit

Well the problem would seem to be one where the IDE is unaware of the include paths it would need to be able to resolve your includes and parse the headers.

I'm not sure how you would fix that with your toolset, but that is something you'd have to setup.

This would be no different from how you would have your IDE be able to code-complete and parse from other libraries. Just that ROS is typically installed into locations that are not on the default search paths, leading to the requirement of telling your IDE where it should look for these headers.

gvdhoorn gravatar imagegvdhoorn ( 2019-06-03 08:59:07 -0500 )edit

I have my include and library paths all specified correctly during compilation, if not, i wouldn't be able to even make the /clock subscription. So, i'm not worried about what the IDE displays regarding ROS integration, what i'm worried about is on the reason why I can easily subscribe to one topic, while not being able to do it to other one with a different .msg type...

Bruno Vieira gravatar imageBruno Vieira ( 2019-06-03 09:07:42 -0500 )edit

So just for my understanding:

  • you're using Makefiles, not Catkin
  • an Eclipse-based IDE
  • don't care about code completion
  • get errors when building an application that uses a particular message type from a package containing custom messages

Is this a correct summary?

gvdhoorn gravatar imagegvdhoorn ( 2019-06-03 09:11:00 -0500 )edit

Exactly! That's a perfect summary of this issue, while adding the strange behaviour of this working 100% for one kind of messages..

Bruno Vieira gravatar imageBruno Vieira ( 2019-06-03 09:18:29 -0500 )edit