tf_broadcaster: fatal error: ros/ros.h: No such file or directory
Working Environment: Ubuntu 18.04 LTS; ROS Melodic.
Hi there, I am running through the TF tutorials on wiki.ros.org , I have simply followed the content of that tutorial. But unfortunately when I try to run the c++ code, there comes an error:
tf_broadcaster.cpp:1:10: fatal error: ros/ros.h: No such file or directory
#include <ros/ros.h>
^~~~~~~~~~~
compilation terminated.
I have also tried to find out the answer from the others whose error are the same to mine. But their solutions didn't work with mine. I will post the CMakeLists and Package file as below(for your guys convinience, I have got rid of the content in comment) :
Thank you for your support!
By the way, the links, that I have looked for to find out the solution, will be posted as below:
link text link text link text link text
CMakeList.txt:
cmake_minimum_required(VERSION 2.8.3)
project(robot_setup_tf)
## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
geometry_msgs
roscpp
tf
)
catkin_package(
#INCLUDE_DIRS include
#LIBRARIES robot_setup_tf
#CATKIN_DEPENDS geometry_msgs roscpp tf
#DEPENDS system_lib
)
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
add_executable(tf_broadcaster src/tf_broadcaster.cpp)
add_executable(tf_listener src/tf_listener.cpp)
target_link_libraries(tf_broadcaster ${catkin_LIBRARIES})
target_link_libraries(tf_listener ${catkin_LIBRARIES})
Package.xml:
<?xml version="1.0"?>
<package format="2">
<name>robot_setup_tf</name>
<version>0.0.0</version>
<description>The robot_setup_tf package</description>
<maintainer email="zhiwei@todo.todo">zhiwei</maintainer>
<license>TODO</license>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>tf</build_depend>
<build_export_depend>geometry_msgs</build_export_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>tf</build_export_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>tf</exec_depend>
<export>
</export>
</package>
Can you please update your question with links to the questions that you're referring to and what happened when you attempted the solutions? This way, people don't suggest what you've already tried.
thanks you for your advices, I have just edited it.