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

ros/ros.h header file not found

asked 2019-10-19 20:29:04 -0500

AldoChavez0212 gravatar image

updated 2019-10-20 01:14:19 -0500

gvdhoorn gravatar image

Hello, I'm pretty new to ROS and I'm implementing a Service node in C++, the problem is, when I try to include the "ros/ros.h" header file, it is not found, and the header file of my service file isn't found either, although it is correctly contained in catkin_ws/devel/include/my_package, I've found that this problem is often caused by an error of configuration in the CMakeLists.txt, but I tried the solutions that were posted in the thread I consulted and it didn't help. My ROS version is Kinetic Kame and I'm using Ubuntu 16.04.

Here's my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)

add_message_files(
   FILES
   Num.msg
   Sensor.msg
  )

add_service_files(
  FILES
  AddTwoInts.srv
  CaracteresComunes.srv
 )


generate_messages(
  DEPENDENCIES
  std_msgs
 )


catkin_package(
   INCLUDE_DIRS include
   LIBRARIES beginner_tutorials
   CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
   DEPENDS system_lib
)




include_directories(${catkin_INCLUDE_DIRS})

add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_dependencies(talker beginner_tutorials_generate_messages_cpp)

add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
add_dependencies(listener beginner_tutorials_generate_messages_cpp)


add_executable(SumarServer src/add_two_ints_server.cpp)
target_link_libraries(SumarServer ${catkin_LIBRARIES})
add_dependencies(SumarServer beginner_tutorials_gencpp)

add_executable(SumarClient src/add_two_ints_client.cpp)
target_link_libraries(SumarClient ${catkin_LIBRARIES})
add_dependencies(SumarClient beginner_tutorials_gencpp)

add_executable(CCServer src/CCServer.cpp)
target_link_libraries(CCServer ${catkin_LIBRARIES})
add_dependencies(CCServer beginner_tutorials_gencpp)

And my package.xml just in case:

<?xml version="1.0"?>
<package format="2">
  <name>beginner_tutorials</name>
  <version>0.0.0</version>
  <description>This package was created to follow the tutorial</description>

  <maintainer email="aldo@todo.todo">aldo</maintainer>

  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>turtlesim</build_depend>
  <build_depend>tf</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <build_export_depend>tf</build_export_depend>
  <build_depend>message_generation</build_depend>
  <exec_depend>message_runtime</exec_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>rospy</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <exec_depend>tf</exec_depend>

  <export>
  </export>
</package>

I would really appreciate the help, guys

edit retag flag offensive close merge delete

Comments

This could be a result of an unorthodox directory structure. Do you have a "srv" folder and an "include" folder that contains the mentioned files in the src/my_package directory (e.g. my_package/srv and my_package/include)?

PSA gravatar image PSA  ( 2019-10-19 23:52:25 -0500 )edit

Oh, my bad, I forgot to mention that, yes, I'm using the suggested folder structure, but the problem was just my IDE's configuration. Thanks a lot for your help!

AldoChavez0212 gravatar image AldoChavez0212  ( 2019-10-20 21:20:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-10-20 09:38:36 -0500

fergs gravatar image

I don't see your "find_package(catkin ...)" near the start of the posted CMakeLists.txt - I'm actually surprised you aren't getting lots of CMake config errors. Check out the details of find_package on the ROS wiki

edit flag offensive delete link more

Comments

Oh, yes, actually I erased that line trying to fix the issue desperately lol, but it was meant to be on the file, thank you very much. I found the actual error, it was simply the IDE I'm using that just had trouble recognizing the location of the header files, but when running the node through the Ubuntu console it works just fine. Again, thanks a lot for your help!

AldoChavez0212 gravatar image AldoChavez0212  ( 2019-10-20 21:19:01 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-10-19 20:29:04 -0500

Seen: 2,039 times

Last updated: Oct 20 '19