本文介绍了'catkin_make'期间的ROS Hydro opencv2链接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ROS Hydro Distro没什么问题.我需要将其用于一个项目,所以不能更改为Indiko.

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

问题是我已经使用catkin_create_pkg packname opencv2 ...来创建我的项目包.但是,当我尝试调用catkin_make时,出现以下错误:

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:

opencv2Config.cmake
opencv2-config.cmake

将"opencv2"的安装前缀添加到CMAKE_PREFIX_PATH或进行设置 "opencv2_DIR"到包含上述文件之一的目录.如果
"opencv2"提供了单独的开发包或SDK,请确保它 已安装.

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.

我知道已经安装了opencv2,因为我可以在rospack find opencv2中找到它,并且可以在与ROS不相关的其他项目中使用它.

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.

我在CMakeLists.txt和package.xml中有以下几行

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

CMakeLists.txt:

CMakeLists.txt:

include_directories( $ {catkin_INCLUDE_DIRS}
$ {opencv2_INCLUDE_DIRS})

include_directories( ${catkin_INCLUDE_DIRS}
${opencv2_INCLUDE_DIRS} )

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

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

package.xml:

package.xml:

<run_depend>opencv2</run_depend>

我尝试使用OpenCV代替opencv2,但这没有任何区别.有什么建议吗?

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

推荐答案

我不确定,但这可能有用:编辑CMakeLists以添加

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

find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})

target_link_libraries(follower ${OpenCV_LIBRARIES})

这篇关于'catkin_make'期间的ROS Hydro opencv2链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 05:51