Age.h file not found in exercise 2.5

Hi, I am struggling to #include my new Age.msg.

Age.msg is in topic_subscriber_pkg package under topic_subscriber_pkg/msg/Age.msg

I have tried
#include <topic_subscriber_pkg/Age.h>
#include <topic_subscriber_pkg/msg/Age.h>
#include <msg/Age.h>
It just can’t seem to find it. Do I need the msg file to be in a seperate pkg to the cpp I am trying to include it in?

best wishes,

Hi @j.nash,

Thanks for contacting us and welcome to the Community!

The right way to include the message would be:

#include <topic_subscriber_pkg/Age.h>

Please ensure that:

  • You have carefully followed the instructions to create your custom message.
  • You have run catkin_make.
  • You have run source ~/catkin_ws/devel/setup.bash on every terminal where you are trying to use the message. This is a common problem.

Please let us know.

Hi there,

Thank you for your response. Still having issues I am afraid. I have done the #include correctly. I have the source and have catkin_make also. If I use rosmsg info Age, I am getting the response showing the msg information. However the #include is still flagging that it cannot find the Age.h file! I have shown this below.


Thank you for the update.

Please ignore that flag and try to use your message and see. It might be a problem with the IDE. Sorry for the confusion.

We’ll look into why the IDE might be giving such false positives.


I seem to meet the same problem, the file can be successfully compiled and publish the data. I use the command source ~/catkin_ws/devel/setup.bash after catkin_make. While I have the error saying age.h not found. Have you found the reason to cause this issue?


Hey @youngyangcs,

Are you able to do

rosmsg info Age

after running source devel/setup.bash?

If not, then your message is not properly compiled yet. Please go over the process to get it compiled again.

If you are able to show the message, is this preventing you from running the program? If not please ignore that warning for now (sorry for the trouble). We’ll look again into why the IDE is not recognizing the message.


I’m able to run rosmsg info Age and I’ll just ignore the flag.

Thanks for the help!

1 Like