OpenCV:CMake Error (find_package): but it set OpenCV_FOUND to FALSE so package "OpenCV" is consider

Ubuntu 16.04下在CMakeLists.txt中添加了OpenCV的头文件,然后把程序连接到库文件上,对CMakeLists.txt进行编译,出现错误大致如下:(终端错误内容和下列相似,但是我的没有保存错误内容)

-- building main

-- 
-- building mrcimg
CMake Warning at /home/zzy/opencv-2.4.6.1/cmake/OpenCVConfig.cmake:153 (message):
  Found OpenCV 2.4.3 Windows Super Pack but it has not binaries compatible
  with your configuration.

       You should manually point CMake variable OpenCV_DIR to your build of OpenCV library.
Call Stack (most recent call first):

  src/mrcimg/CMakeLists.txt:7 (find_package)


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

    /home/zzy/opencv-2.4.6.1/cmake/OpenCVConfig.cmake

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


-- Configuring incomplete, errors occurred!

以上为终端中的报错信息,系统为ubuntu,opencv已安装测试过.

解决方法:

在CMakeLists.txt中find_package( OpenCV REQUIRED )这行代码后面添加一行代码指定OpenCV 的路径。

我的是添加这一行set(OpenCV_DIR /usr/local/share/OpenCV)

在我的电脑上默认OpenCV 安装在/usr/local/share/OpenCV路径下的。




你可能感兴趣的:(解决问题,OpenCV,SLAM第五讲)