thanks @salem for pointer in this direction.

I have a CMakeLists.txt file. I wanted to create separate ROS nodes (executable) one based on CMotionPlanner and other based on CCollisionObject. Thus, initially, my CMakeLists.txt looked as follows.

Code:
add_executable(motion_node src/main.cpp src/motionplanner.cpp)
add_executable(obs_node src/ccollisionobject.cpp)

## Specify libraries to link a library or executable target against
target_link_libraries(motion_node ${catkin_LIBRARIES})
target_link_libraries(obs_node ${catkin_LIBRARIES})
but, when I changed it to
Code:
add_executable(motion_node src/main.cpp src/motionplanner.cpp)
add_executable(obs_node src/motionplanner.cpp src/ccollisionobject.cpp)

## Specify libraries to link a library or executable target against
target_link_libraries(motion_node ${catkin_LIBRARIES})
target_link_libraries(obs_node ${catkin_LIBRARIES})
it compiles correctly, producing two nodes motion_node, and obs_node.

Do you think, this kind of reasoning has any logical flaws to it.

thanks,
Zahid