Ask Your Question

catkin_make error when build talker and listener

asked 2017-04-24 22:18:49 -0600

Caryzhou gravatar image

updated 2017-04-25 01:45:42 -0600

rbbg gravatar image

I follow the tutorials and make talker.cpp and listener.cpp in the dir ~/catkin_ws/src/beginner_tutorials/src. I add the CMakelist.txt like the following lines:

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)

but when I cd ~/catkin_ws and catkin_make this error happened :

Base path: /home/linux/catkin_ws
Source space: /home/linux/catkin_ws/src
Build space: /home/linux/catkin_ws/build
Devel space: /home/linux/catkin_ws/devel
Install space: /home/linux/catkin_ws/install
#### Running command: "make cmake_check_build_system" in "/home/linux/catkin_ws/build"
#### Running command: "make -j2 -l2" in "/home/linux/catkin_ws/build"
Scanning dependencies of target listener
Scanning dependencies of target talker
make[2]: *** No rule to make target 'beginner_tutorials/CMakeFiles/listener.dir/build'.  Stop.
CMakeFiles/Makefile2:473: recipe for target 'beginner_tutorials/CMakeFiles/listener.dir/all' failed
make[1]: *** [beginner_tutorials/CMakeFiles/listener.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 50%] Building CXX object beginner_tutorials/CMakeFiles/talker.dir/src/talker.cpp.o
[100%] Linking CXX executable /home/linux/catkin_ws/devel/lib/beginner_tutorials/talker
[100%] Built target talker
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j2 -l2" failed

So what should I do to solve the problem

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-04-25 02:10:50 -0600

Check that listener.cpp is in the specified directory and has the correct name.

edit flag offensive delete link more


thank you I'sorry to name the file the wrong name ,thank you very much!

Caryzhou gravatar image Caryzhou  ( 2017-04-25 07:43:31 -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

1 follower


Asked: 2017-04-24 22:18:49 -0600

Seen: 2,087 times

Last updated: Apr 25 '17