Undefined reference to `cv::CascadeClassifier::empty() const'

when i write:
CascadeClassifier faceCascade;
faceCascade.load(“…/peripheral/cv_zone/Resources/haarcascade_frontalface_default.xml”);
if (faceCascade.empty()) {
cout << “XML file not loaded” << endl;
}
I got error as follows:
/usr/bin/ld: CMakeFiles/vedio_opencv.dir/with_opencv/src/cv_zone_Project3.cpp.o: in function cv_zone_faceDetection()': cv_zone_Project3.cpp:(.text+0x80): undefined reference to cv::CascadeClassifier::CascadeClassifier()’
/usr/bin/ld: cv_zone_Project3.cpp:(.text+0xc5): undefined reference to cv::CascadeClassifier::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/bin/ld: cv_zone_Project3.cpp:(.text+0xf2): undefined reference to cv::CascadeClassifier::empty() const’
/usr/bin/ld: cv_zone_Project3.cpp:(.text+0x1bf): undefined reference to cv::CascadeClassifier::~CascadeClassifier()' /usr/bin/ld: cv_zone_Project3.cpp:(.text+0x299): undefined reference to cv::CascadeClassifier::~CascadeClassifier()’
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/vedio_opencv.dir/build.make:331:/home/zero/openCV/chip_phytium/opencv_output/vedio_opencv] 错误 1
make[1]: *** [CMakeFiles/Makefile2:83:CMakeFiles/vedio_opencv.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2

But when I trace the defination of CascadeClassifier , I can find it in objdetect.hpp .so I checked my CMakelist.txt ,it sames right
Could someone help me ,please

this is a linker problem, please check, if you are correctly linking your code against the opencv_objdetect lib.

also it seems to want std::__cxx11 strings, so find out, if your program using it will have the same c++ flags, the lib was built with.