OpenCV C++ CascadeClassifier not linked

asked 2020-05-11 11:08:11 -0500

dade01 gravatar image

Hello! I've tried to use a Haar Cascade Visualization under Ubuntu 18.04, with the latest dependencies installed with apt-get. I use CLion as the IDE. Unfortunately, i get the following error:

undefined reference to `cv::CascadeClassifierImpl::~CascadeClassifierImpl()'

The error occurs at the line where the classifier is loaded ( the xml file exists, and it is in the current directory:

if( !cascade.load( cascadeName ) ) { cerr << "ERROR: Could not load classifier cascade" << endl; return -1; }

My CMakeLists file contains the following:

cmake_minimum_required(VERSION 3.15)


project( visualization ) find_package( OpenCV REQUIRED ) include_directories( ${OpenCV_INCLUDE_DIRS} ) add_executable( DisplayImage HaarCascadeVisualiser.cpp ) target_link_libraries( DisplayImage ${OpenCV_LIBS} )

The build shows no errors, and a simple OpenCv "Hello World" works fine.

Thank you!

edit retag flag offensive close merge delete