Ask Your Question


asked 2018-02-26 13:24:32 -0600

Prof. xavier gravatar image

updated 2018-02-26 13:34:55 -0600

gvdhoorn gravatar image

Hello, I am using kinetic and I am trying to run a simple publisher and subscriber.

the cmakelists.xml has the following code.

cmake_minimum_required(VERSION 2.8.3)

cmake_policy(SET CMP0046 OLD)

find_package(catkin REQUIRED COMPONENTS


add_executable(demo_topic_publisher src/demo_topic_publisher.cpp) 
add_executable(demo_topic_subscriber src/demo_topic_subscriber.cpp)

add_dependencies(demo_topic_publisher ${mastering_ros_demo_pkg}_gencfg)
add_dependencies(demo_topic_subscriber ${mastering_ros_demo_pkg}_gencfg)

target_link_libraries(demo_topic_publisher ${catkin_LIBRARIES}) 
target_link_libraries(demo_topic_subscriber ${catkin_LIBRARIES})

after running rosrun i get the following error :

[rosrun] Couldn't find executable named demo_topic_publisher below /home/xavier/catkin_ws/src/mastering_ros_demo_pkg

I did source the setup.bash after catkin_make but still the issue was not sovled.

Please help me out here.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-02-26 13:35:53 -0600

gvdhoorn gravatar image

updated 2018-02-26 13:37:18 -0600

If that is really your CMakeLists.txt, it would appear you are missing a call to catkin_package(..).

See wiki/catkin/CMakeLists.txt for an overview of the various parts and why and when they are needed. See wiki/catkin/CMakeLists.txt - catkin_package() specifically.

edit flag offensive delete link more


I added the catkin_package but I still the same issue

Prof. xavier gravatar imageProf. xavier ( 2018-02-26 13:53:42 -0600 )edit

Please make sure to delete your devel and build folders, rebuild your workspace and then source /home/xavier/catkin_ws/devel/setup.bash.

gvdhoorn gravatar imagegvdhoorn ( 2018-02-26 13:59:22 -0600 )edit

Also: could you update your question text and add the new CMakeLists.txt (do not overwrite your previous one), so it shows where you added catkin_package(..)? Use the edit button/link for that.

gvdhoorn gravatar imagegvdhoorn ( 2018-02-26 14:00:25 -0600 )edit

okay, thanks for helping I will try this and post if any issues come along.

Prof. xavier gravatar imageProf. xavier ( 2018-02-26 14:01:09 -0600 )edit

Did you resolve this issue? If so, please click on the checkmark next to the answer to mark the question as answered.

gvdhoorn gravatar imagegvdhoorn ( 2018-03-24 05:22:53 -0600 )edit

thanks gvdhoom, fixed it for me

taxi711 gravatar imagetaxi711 ( 2018-08-16 12:40:21 -0600 )edit

type chmod +x "your programfile"
and you can confirm rosrunable file

digitalhub gravatar imagedigitalhub ( 2019-03-11 23:03:10 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-02-26 13:24:32 -0600

Seen: 1,336 times

Last updated: Feb 26 '18