error: undefined reference to `cv::imread(cv::String const&, int)' 解决方法
编译时出现下列错误:
undefined reference to 'cv::imread(cv::String const&, int)'
undefined reference to 'cv::String::deallocate()'
undefined reference to 'cv::imread(cv::String const&, int)'
undefined reference to 'cv::String::deallocate()'
undefined reference to 'cv::String::allocate(unsigned long)'
undefined reference to 'cv::String::allocate(unsigned long)'
undefined reference to 'cv::String::deallocate()'
undefined reference to 'cv::String::deallocate()'
解决方法:在CMakeLists.txt加入安装OpenCV的版本号:
将
find_package( OpenCV REQUIRED )
更改为
find_package( OpenCV 3 REQUIRED ) 。