ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
When you need to build a node which created by a cpp file, your CMake file should look like this:
cmake_minimum_required(VERSION 3.0.2)
Project(package_name)
# if there is another "No such file or directory" error
# you may want to add that missing library like rospy, std_msgs, e.g.
find_package(catkin REQUIRED COMPONENTS roscpp)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES motion_plan
# CATKIN_DEPENDS other_catkin_pkg
# DEPENDS system_lib
)
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(node_name src/file_name.cpp)
target_link_libraries(node_name ${catkin_LIBRARIES})
I was stuck with this erro and then this worked for me.