SLAM14讲joinMap编译错误

问题

找不到OpenCV

CMake Error at CMakeLists.txt:7 (find_package):
  Found package configuration file:

    /usr/local/share/OpenCV/OpenCVConfig.cmake

  but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
  NOT FOUND.

CMakeLists文件

cmake_minimum_required( VERSION 2.8)
project(_joinMap)

set(CMAKE_CXX_STANDARD 11)
#set(OpenCV_DIR /home/s/opencv-3.1.0/build)
#set(OpenCV_FOUND 1)
find_package(OpenCV 3 REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

find_package(Eigen3 )
include_directories(${Eigen3_INCLUDE_DIRS})

find_package(PCL REQUIRED )
include_directories(${PCL_INCLUDE_DIRS})
add_definitions(${PCL_DEFINITIONS})

add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp)
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${PCL_LIBRARIES})

解决

多方查阅,在find_package(OpenCV 3 REQUIRED)之前加入

set(OpenCV_DIR /home/s/opencv-3.1.0/build)
set(OpenCV_FOUND 1)

解决。

PS:

set(OpenCV_DIR /home/s/opencv-3.1.0/build)

一定要注意是DIR没有S

 

你可能感兴趣的:(OpenCV3.1.0,SLAM)