openCV---linux下编译报错

来源:互联网 发布:健身器材什么牌子 知乎 编辑:程序博客网 时间:2024/06/05 04:15

linux编译opencv代码时报错:

 By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has  asked CMake to find a package configuration file provided by "OpenCV", but  CMake did not find one.  Could not find a package configuration file provided by "OpenCV" with any  of the following names:    OpenCVConfig.cmake    opencv-config.cmake  Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set  "OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"  provides a separate development package or SDK, be sure it has been  installed.-- Configuring incomplete, errors occurred!

需要在CMakelist.txt中添加

set(OpenCV_DIR ~/openCV/opencv-2.4.9/build)

~/openCV/opencv-2.4.9/build 目录是当初安装openCV时建的

ls ~/openCV/opencv-2.4.9/build
3rdparty               CPackSourceConfig.cmake  Makefileapps                   cvconfig.h               modulesbin                    data                     opencv2CMakeCache.txt         doc                      OpenCVConfig.cmakeCMakeFiles             include                  OpenCVConfig-version.cmakecmake_install.cmake    install_manifest.txt     OpenCVModules.cmakecmake_uninstall.cmake  junk                     unix-installCPackConfig.cmake      lib                      version_string.tmp

参考
http://blog.csdn.net/brightming/article/details/50402399