Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

/home/ros/catkin_ws/src/beginner_tutorials

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!