1.cmake 链接opencv库时出现以下错误
cmake文件
cmake_minimum_required(VERSION 2.8)
project( PedestrianDetection )
find_package( OpenCV REQUIRED )
add_executable( PedestrianDetection PedestrianDetection.cpp )
target_link_libraries( ${OpenCV_LIBS} )
错误
CMake Error at CMakeLists.txt:5 (target_link_libraries):
Cannot specify link libraries for target “opencv_videostab” which is not
built by this project.
解决
target_link_libraries( ${OpenCV_LIBS} )
改为
target_link_libraries(PedestrianDetection ${OpenCV_LIBS} )
2.使用ROS 自带的opencv2.4.8 没有nofree.hpp模块
致命错误: opencv2/nonfree/nonfree.hpp:没有那个文件或目录
解决
sudo apt-get update
sudo add-apt-repository --yes ppa:xqms/opencv-nonfree
sudo apt-get update
sudo apt-get install libopencv-nonfree-dev