Services Server fatal error: ros/ros.h: No such file or directory

I am trying to complete Ex. 3.3 in the service server section. And I am getting this error fatal error: ros/ros.h: No such file or directory. I know it is likely an issue with my make file.

Do I need to do anything with the generate messages portion of the make file?

Hey @rmmilner,

Something is fundamentally wrong here. You shouldn’t have this problem at all, because that is a built-in header…

  • Did you add the right dependencies when creating your package? e.g.
catkin_create_package my_package roscpp ....
  • Is there a typo in your #include line?
  • Did you follow the steps required for setting up your CMakeLists.txt and package.xml for (1) your c++ source file and (2) any custom service message?
1 Like

So I am just confused about what changes need to be made to the makefile and Launch, because that is where the error is from I think. The purpose of this assignment is to start a simple service server with an empty service.

For the makefile, do I need to do anything beyond the typical lines to add executable, dependencies and links?
For the launch file do I need to add a line like the one that is commented out?

  • According to the exercise the only dependency that is required is roscpp, so my create pkg is just ‘catkin_create_pkg my_package roscpp’

  • The #include line is copied from the included cpp file for the exercise. The construction given there is #include “ros/ros.h” but the error is still present when I use #include <ros/ros.h>

  • I don’t believe this exercise has any custom service messages. The service is the ‘std_srvs/Empty’ service.

Looking at the solutions for Ex. 3.4 make make and launch files do seem correct. I have included an image of the full error output, the cpp file and the xml file.

Solution:

The issue I think was coming from the make file: Line 13, inside first curly brace should have been {simple_service_server_EXPORTED_TARGETS}

1 Like

Thanks a lot @bayodesegun !
I have the same problem, and it seems that I forgot to add the dep when creating the package.

catkin_create_package my_package roscpp ...

1 Like