ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In building one executable from multiple files only one file will be having main() function and will be using/calling functions and classes defined in other files. All the files are compiled to object files and then linked to one executable.

add_executable(LMS1xx_node src/LMS1xx_node.cpp src/LMS1xx.cpp)

In this main is defined in LMS1xx_node.cpp and using class LMS1xx defined in LMS1xx.cpp.

Note : dont be confused with executable name as fiile name it can be anything.

add_executable(exename src/aaaa.cpp src/bbb.cpp)