切换opencv版本,出现 fatal error: opencv2/legacy/legacy.hpp: No such file or directory

CMakeLists的一点点修改
因为usr/local/opencv3/share/OpenCV/OpenCVConfig.cmake中设置了opencv的配置,自定义路径安装opencv时,找不到这个文件OpenCVConfig.cmake,opencv-config.cmake
需要在项目的CMakeList.txt中添加OpenCVConfig.cmake的路径
路径为自己安装opencv2.x版本的路径

set(CMAKE_PREFIX_PATH "/usr/local/opencv2410/share/OpenCV")

你可能感兴趣的:(opencv)