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

[rospack] Error: package 'beginner_tutorials' not found

asked 2019-03-24 06:54:01 -0600

designthala gravatar image

I followed the tutorials for ROS kinetic and in the writing a publisher and subscriber in C++ after copying the cpp files in the src folder of beginner_tutorials folder i pass:

cd ~/catkin_ws 

When I build the workspace using catkin_make after copying the talker.cpp and listener.cpp in the ~catkin_ws/src/beginner_tutorials/src i get the following output:

    ros@ros-HP-280-G2-SFF:~/catkin_ws$ catkin_make
    Base path: /home/ros/catkin_ws
    Source space: /home/ros/catkin_ws/src
    Build space: /home/ros/catkin_ws/build
    Devel space: /home/ros/catkin_ws/devel
    Install space: /home/ros/catkin_ws/install
    #### Running command: "make cmake_check_build_system" in "/home/ros/catkin_ws/build"

#### Running command: "make -j4 -l4" in "/home/ros/catkin_ws/build"

then when i open new terminal and pass

source ~/catkin_ws/devel/setup.bash
rosrun beginner_tutorials talker

the errors are as follows:

 [rosrun] Couldn't find executable named talker below /home/ros/catkin_ws/src/beginner_tutorials

When I see this tutorial they are also following the same steps and while they give catkin_make command the output has few more lines like

[50%] Built target talker
[100%] Built target listener

which I am not getting.

I tried the solutions mentioned to similar problems, tried to chmod +x talker.cpp in the src folder of the package. Still getting the same error


PS: I am an engineer from mechanical branch with little experience in coding, usually I copy+paste of the errors in google helps me solve them from people who have previously faced and solved.

edit retag flag offensive close merge delete


Can you please edit the question and add your CMakeLists.txt file here?

janindu gravatar image janindu  ( 2019-03-24 21:06:33 -0600 )edit

It's likely that @designthala hasn't added the talker and listener targets to their CMakeLists.txt, causing Catkin to not actually build anything. That would explain both the missing lines in the build output and the fact that the nodes cannot be found by rosrun.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-25 04:14:12 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-03-25 10:55:25 -0600

designthala gravatar image

Many thanks @gvdhoorn you are right!

I read something about adding targets to the CMakeLists.txt in some solutions but I didnt know what it means so I ignored those instructions.

Now after going through the ROS Kinetic Tutorials page slowly I found out that by adding the below mentioned lines at the end of the CMakeLists.txt present in


the catkin_make command builds both the cpp files in the src folder:

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)

Thank you @janindu and @gvdhoorn for extending helping hands!

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-03-24 06:43:02 -0600

Seen: 2,723 times

Last updated: Mar 25 '19