'catkin_make'期间的ROS Hydro opencv2链接错误 [英] ROS hydro opencv2 linking error during 'catkin_make'
问题描述
我的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:
在/opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake中的CMake错误:75 (find_package):找不到提供的程序包配置文件 通过"opencv2"使用以下任意名称:
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
将"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:
find_package(catkin必需组件opencv2)
find_package(catkin REQUIRED COMPONENTS opencv2)
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:
<build_depend>opencv2</build_depend>
<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链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!