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 addition to what @William posted, some other comments:

  • perhaps it wasn't copy/pasted, but I don't see an include_directories(include ${OpenCV_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS}) anywhere, which could also be responsible for the not declared error.
  • you only need to find_package(OpenCV) once, the results get cached. Also, I'd add a REQUIRED to that, as your code can't compile without OpenCV being available.
  • you can link your my_publisher target to multiple (sets of) libraries with a single target_link_libraries(..) invocation. Just do: target_link_libraries(my_publisher ${OpenCV_LIBS} ${catkin_LIBRARIES}).
  • is image_transport_tutorial_cpp (from add_dependencies(my_subscriber image_transport_tutorial_cpp)) an actual target from image_transport? Perhaps you meant image_transport_tutorial_gencpp (which is deprecated, afaik)?

Minor things, but they make your CMakeLists.txt a bit easier to read and maintain.

In addition to what @William posted, some other comments:

  • perhaps it wasn't copy/pasted, but I don't see an an

    include_directories(include ${OpenCV_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})${catkin_INCLUDE_DIRS})
     

    anywhere, which could also be responsible for the not declared error.

  • you only need to find_package(OpenCV) once, the results get cached. Also, I'd add a REQUIRED to that, as your code can't compile without OpenCV being available.
  • you can link your my_publisher target to multiple (sets of) libraries with a single target_link_libraries(..) invocation. Just do: do:

    target_link_libraries(my_publisher ${OpenCV_LIBS} ${catkin_LIBRARIES})${catkin_LIBRARIES})
    .
  • is image_transport_tutorial_cpp (from add_dependencies(my_subscriber image_transport_tutorial_cpp)..)) an actual target from image_transport? Perhaps you meant image_transport_tutorial_gencpp (which is deprecated, afaik)?

Minor things, but they make your CMakeLists.txt a bit easier to read and maintain.

In addition to what @William posted, some other comments:

  • perhaps it wasn't copy/pasted, but I don't see an

    include_directories(include ${OpenCV_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})
    

    anywhere, which could also be responsible for the not declared error.

  • you only need to find_package(OpenCV) once, the results get cached. Also, I'd add a REQUIRED to that, as your code can't compile without OpenCV being available.
  • you can link your my_publisher target targets to multiple (sets of) libraries with a single target_link_libraries(..) invocation. Just do:

    target_link_libraries(my_publisher ${OpenCV_LIBS} ${catkin_LIBRARIES})
    

    for the my_publisher target fi.

  • is image_transport_tutorial_cpp (from add_dependencies(my_subscriber ..)) an actual target from image_transport? Perhaps you meant image_transport_tutorial_gencpp (which is deprecated, afaik)?

Minor things, but they make your CMakeLists.txt a bit easier to read and maintain.