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

I had this same problem and wanted to add that sometimes the order in which you add dependencies and target link libraries matters. For example I have a target which depends on action files generated from one package (action_package) and a class generated from its own package (your_program_class). In the following scenario catkin_make failed:

add_executable(your_program src/your_program.cpp)
target_link_libraries(
    your_program your_program_class ${catkin_LIBRARIES}
)
add_dependencies(your_program ${catkin_EXPORTED_TARGETS})

However if I changed the order, catkin_make succeeded:

add_executable(your_program src/your_program.cpp)
add_dependencies(your_program ${catkin_EXPORTED_TARGETS})
target_link_libraries(
    your_program your_program_class ${catkin_LIBRARIES}
)

I am not sure if this problem is repeatable but I banged my head against the wall for a while so hopefully this will help someone.

I had this same problem and wanted to add that sometimes the order in which you add dependencies and target link libraries matters. also need a secondary depency. For example I have a target (your_program) which depends on action files generated from one a secondary package (action_package) and a class generated from its own package (your_program_class). (action_package). In the following scenario catkin_make failed:

add_executable(your_program src/your_program.cpp)
target_link_libraries(
    your_program your_program_class ${catkin_LIBRARIES}
)
add_dependencies(your_program ${catkin_EXPORTED_TARGETS})

However if I changed the order, catkin_make succeeded:requires:

add_executable(your_program src/your_program.cpp)
add_dependencies(your_program ${catkin_EXPORTED_TARGETS})
target_link_libraries(
    your_program your_program_class ${catkin_LIBRARIES}
${catkin_EXPORTED_TARGETS} action_package_generate_messages_cpp )

Otherwise the catkin_make will fail because it cannot find the headers for a particular action file. I am not sure if this problem is repeatable but I banged my head against the wall for a while so hopefully this will help someone.