ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

After using catkin_make the executable exists 2 times

asked 2014-09-01 13:39:45 -0500

updated 2014-09-01 17:25:14 -0500

ahendrix gravatar image

After making with catkin_make, when I start my node with rosrun, I get the following message:

You have chosen a non-unique executable, please pick one of the following:
1) /home/name/ros/devel/lib/gero_move/servo_driver
2) /home/name/ros/src/gero_move/servo_driver

CMakeLists.txt is as follows:

cmake_minimum_required(VERSION 2.8.3)
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs gero_msgs message_generation)
catkin_package( CATKIN_DEPENDS gero_msgs)
add_executable(servo_driver servo_driver.cpp)

I use Ubuntu and ROS Indigo. Even if I delete build and devel directory and make catkin_make again, it creates both files new. What could be root cause for this?

Thanks for any help :-)

edit retag flag offensive close merge delete


Can you edit your question to add your CMakeLists.txt?

ahendrix gravatar image ahendrix  ( 2014-09-01 13:52:36 -0500 )edit

Thanks for your kind request, I added it.

Johannes Jaegers gravatar image Johannes Jaegers  ( 2014-09-01 14:29:06 -0500 )edit

not sure, but please try to rename your .cpp file with another name and try again: for istance: add_executable(servo_driver main_servo.cpp)

Andromeda gravatar image Andromeda  ( 2014-09-01 14:53:44 -0500 )edit

Thanks a lot for your help, when I delete it in the src directory, it does not get recreated again by catkin_make. So I assume it is right, that the executable is only in the devel directory?What do I do with data files I have to read in, do I have to make catkin copy this file to the devel directo?

Johannes Jaegers gravatar image Johannes Jaegers  ( 2014-09-02 11:20:18 -0500 )edit

Ok, I found out that working directory is the workspace, for me home/jonny/ros. So if I place data files there, I can access them with a relative pathname. Thanks a lot for all your answeres, it helped me a lot!! :-) Ahendirx, can you convert your comment to an answer, so I can mark as solved?

Johannes Jaegers gravatar image Johannes Jaegers  ( 2014-09-02 11:46:01 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-09-01 17:24:41 -0500

ahendrix gravatar image

Your CMakeLists.txt looks reasonable. Have you tried removing the executable in the src directory and confirming that it gets recreated when you do a build?

edit flag offensive delete link more


after removing in the src directory "src/gero_move/servo_driver" the problem was gone.

Johannes Jaegers gravatar image Johannes Jaegers  ( 2014-09-02 14:37:44 -0500 )edit

answered 2014-09-01 14:23:41 -0500

Andromeda gravatar image

Sometime you will find more executables in the same package. Of course they are compiled with different name_file.cpp files. Look into you CMakeLists.txt and be sure you don t have 2 times the same add_executable. For istance:

add_executable( my_robot src/main_a.cpp )
add_executable( my_robot src/main_b.cpp )   <= this is redundant with the line above

Hope it helps

edit flag offensive delete link more


Thanks for your kind reply. Unfortunately I only use the "add_executable" once... I added cmakelists.txt above.

Johannes Jaegers gravatar image Johannes Jaegers  ( 2014-09-01 14:29:43 -0500 )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

1 follower


Asked: 2014-09-01 13:39:45 -0500

Seen: 1,126 times

Last updated: Sep 01 '14