Bugi
Bugi

Reputation: 11

ROS hydro opencv2 linking error during 'catkin_make'

I have little problem with my ROS hydro distro. I need to use it for one project so can't change to Indiko.

Problem is that I have used catkin_create_pkg packname opencv2 ... for creating my project package. But when I try to invoke catkin_make I get following errors:

CMake Error at /opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake:75 (find_package): Could not find a package configuration file provided by "opencv2" with any of the following names:

opencv2Config.cmake
opencv2-config.cmake

Add the installation prefix of "opencv2" to CMAKE_PREFIX_PATH or set "opencv2_DIR" to a directory containing one of the above files. If
"opencv2" provides a separate development package or SDK, be sure it has been installed.

I know that opencv2 is installed, because I can find it with rospack find opencv2 and I can use it in other projects not related to ROS.

I have following lines in CMakeLists.txt and package.xml

CMakeLists.txt:

find_package(catkin REQUIRED COMPONENTS opencv2)

include_directories( ${catkin_INCLUDE_DIRS}
${opencv2_INCLUDE_DIRS} )

target_link_libraries(BasicObstDetect_node
${catkin_LIBRARIES}
${opencv2_LIBRARIES} )

package.xml:

<build_depend>opencv2</build_depend>

<run_depend>opencv2</run_depend>

I have tried to use OpenCV instead of opencv2 but that didn't make any difference. Any advices?

Upvotes: 1

Views: 2771

Answers (1)

a-Jays
a-Jays

Reputation: 1212

I'm not sure, but this might work: edit your CMakeLists to add

find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})

and target_link_libraries(follower ${OpenCV_LIBRARIES})

Upvotes: 5

Related Questions