How do we usually name the executable of a C++ file?
By default it is ${PROJECT_NAME}_node
in the CmakeList.txt, shall we always change it or not?
Here is the lesson note:
5- Modify the CMakeLists.txt file in order to generate an executable from the C++ file you have just created.
Note: This is something that is required when working in ROS with C++. When you finish this Exercise, you’ll learn more about this subject. For now, just follow the instructions below.
In the Build section of your CMakeLists.txt file, add the following lines:
add_executable(simple src/simple.cpp) add_dependencies(simple ${simple_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) target_link_libraries(simple ${catkin_LIBRARIES} )
HINT: If you have a look at the file, you’ll see that those lines are already in the file, but they are commented. If you feel so, you can uncomment those lines and modify them like the ones we provide above, instead of simply adding them to the end of the section.