CMake Error - WritingPublisherSubscriber(c++)
Hello everyone,
I'm new to ROS and browsing ROS tutorials I'm stuck with the problem in Writing a Simple Publisher and Subs.. tutorial.
Basically I followed it till the end and finally when I want to execute the catkin_make in catkin_ws $ I get an error message
CMake Error at /opt/ros/kinetic/share/genmsg/cmake/genmsg-extras.cmake:94 (message):
add_message_files() directory not found:
/home/hyuu/catkin_ws/src/beginner_tutorials/msg
Call Stack (most recent call first):
beginner_tutorials/CMakeLists.txt:8 (add_message_files)
This is how my CMakeLists.txt inside beginner_tutorials folder looks like(copy-paste from tutorials):
cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)
## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg)
## Declare ROS messages and services
add_message_files(DIRECTORY msg FILES Num.msg)
add_service_files(DIRECTORY srv FILES AddTwoInts.srv)
## Generate added messages and services
generate_messages(DEPENDENCIES std_msgs)
## Declare a catkin package
catkin_package()
include_directories(include ${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)
Thanks for any help provided!
Do you actually have a
/home/hyuu/catkin_ws/src/beginner_tutorials/msg
directory? Is your Num.msg file in that directory? If yes to both, what are the permissions on the directory and file?Actually I did everything as described in tutorial and I do not have that folder or any file. I browsed a lot of different answers but none of them helped me. Did I miss some steps? I assumed it's made automatically or sth.
The Creating a ROS msg and srv tutorial that @jayess linked to in his answer has a section where you specifically create the message and service files in the
msg/
andsrv/
directories.