gpt4 book ai didi

c++ - 'catkin_make' 期间 ROS hydro opencv2 链接错误

转载 作者:太空宇宙 更新时间:2023-11-03 22:00:57 25 4
gpt4 key购买 nike

我的 ROS hydro 发行版没有什么问题。我需要将它用于一个项目,因此无法更改为 Indiko。

问题是我使用了catkin_create_pkg packname opencv2 ...用于创建我的项目包。但是当我尝试调用 catkin_make 时我收到以下错误:

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.

我知道安装了 opencv2,因为我可以用 rospack find opencv2 找到它我可以在其他与 ROS 无关的项目中使用它。

我在 CMakeLists.txt 和 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} )

包.xml:

<build_depend>opencv2</build_depend>

<run_depend>opencv2</run_depend>

我曾尝试使用 OpenCV 而不是 opencv2,但这没有任何区别。有什么建议吗?

最佳答案

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

find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})

target_link_libraries(跟随者 ${OpenCV_LIBRARIES})

关于c++ - 'catkin_make' 期间 ROS hydro opencv2 链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26264306/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com