我正在尝试用arUco构建一个项目。
我使用的是openCV v.3.1,其中显然包括aruco。但是,我得到了错误:
opencv2/aruco/dictionary.hpp: No such file or directory
#include "opencv2/aruco/dictionary.hpp"
^然后我下载了arUco,构建了它,并试图构建http://www.uco.es/investiga/grupos/ava/node/26底部描述的示例。我知道错误:
fatal error: aruco/aruco.h: No such file or directory
#include <aruco/aruco.h>
^使用的CMakeLists.txt是:
cmake_minimum_required(VERSION 2.8)
project(aruco_testproject)
SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/lib/cmake/ )
MESSAGE(${CMAKE_MODULE_PATH})
find_package(aruco REQUIRED )
add_executable(aruco_simple aruco_simple.cpp)
target_link_libraries(aruco_simple ${aruco_LIBS})我将Findaruco.cmake复制到/usr/local/lib/cmake/
如果有人能帮忙,那就太好了。我已经寻找了一段时间的解决方案,我觉得自己被困住了。非常感谢!
发布于 2016-06-19 23:35:27
你错过了include_directories节。此外,我认为库的正确变量名后缀应该是_LIBRARIES,而不是_LIBS,但是afaik,cmake无法强制执行任何带有流氓cmake模块的规则,所以最好的选择可能是尝试几个公共后缀。这是cmake的暴行之一。
cmake_minimum_required(VERSION 2.8)
project(aruco_testproject)
SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/lib/cmake/ )
MESSAGE(${CMAKE_MODULE_PATH})
find_package(aruco REQUIRED )
add_executable(aruco_simple aruco_simple.cpp)
include_directories(${ARUCO_INCLUDE_DIR} ${ARUCO_INCLUDE_DIRS})
target_link_libraries(aruco_simple ${ARUCO_LIBRARY} ${ARUCO_LIBRARIES})对于头包含,#include <aruco/aruco.h>看起来很好,但#include "opencv2/aruco/xxx"看起来不太好。
https://stackoverflow.com/questions/37911657
复制相似问题