Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I found this error while running sample cpp example facedetect.cpp 'undefiend reference to cv:

/tmp/ccbH13my.o: In function main': facedetect.cpp:(.text+0x10e): undefined reference tocv::VideoCapture::VideoCapture()' facedetect.cpp:(.text+0x14a): undefined reference to cv::CascadeClassifier::CascadeClassifier()' facedetect.cpp:(.text+0x159): undefined reference tocv::CascadeClassifier::CascadeClassifier()' facedetect.cpp:(.text+0x192): undefined reference to cv::CommandLineParser::CommandLineParser(int, char const* const, cv::String const&)' facedetect.cpp:(.text+0x1d0): undefined reference tocv::CommandLineParser::has(cv::String const&) const' facedetect.cpp:(.text+0x36c): undefined reference to cv::CommandLineParser::has(cv::String const&) const' facedetect.cpp:(.text+0x3ff): undefined reference tocv::CommandLineParser::check() const' facedetect.cpp:(.text+0x415): undefined reference to cv::CommandLineParser::printErrors() const' facedetect.cpp:(.text+0x44e): undefined reference tocv::CascadeClassifier::load(cv::String const&)' facedetect.cpp:(.text+0x4bd): undefined reference to cv::CascadeClassifier::load(cv::String const&)' facedetect.cpp:(.text+0x5be): undefined reference tocv::VideoCapture::open(int)' facedetect.cpp:(.text+0x66c): undefined reference to cv::imread(cv::String const&, int)' facedetect.cpp:(.text+0x6ec): undefined reference tocv::VideoCapture::open(cv::String const&)' facedetect.cpp:(.text+0x77e): undefined reference to cv::imread(cv::String const&, int)' facedetect.cpp:(.text+0x7ff): undefined reference tocv::VideoCapture::isOpened() const' facedetect.cpp:(.text+0x836): undefined reference to cv::VideoCapture::operator>>(cv::Mat&)' facedetect.cpp:(.text+0x8c3): undefined reference tocv::waitKey(int)' facedetect.cpp:(.text+0x9b3): undefined reference to cv::waitKey(int)' facedetect.cpp:(.text+0xafa): undefined reference tocv::imread(cv::String const&, int)' facedetect.cpp:(.text+0xb8b): undefined reference to cv::waitKey(int)' facedetect.cpp:(.text+0xc19): undefined reference tocv::CommandLineParser::~CommandLineParser()' facedetect.cpp:(.text+0xc28): undefined reference to cv::CascadeClassifier::~CascadeClassifier()' facedetect.cpp:(.text+0xc37): undefined reference tocv::CascadeClassifier::~CascadeClassifier()' facedetect.cpp:(.text+0xc73): undefined reference to cv::VideoCapture::~VideoCapture()' facedetect.cpp:(.text+0xe0e): undefined reference tocv::CommandLineParser::~CommandLineParser()' facedetect.cpp:(.text+0xe22): undefined reference to cv::CascadeClassifier::~CascadeClassifier()' facedetect.cpp:(.text+0xe36): undefined reference tocv::CascadeClassifier::~CascadeClassifier()' facedetect.cpp:(.text+0xe77): undefined reference to cv::VideoCapture::~VideoCapture()' /tmp/ccbH13my.o: In functiondetectAndDraw(cv::Mat&, cv::CascadeClassifier&, cv::CascadeClassifier&, double, bool)': facedetect.cpp:(.text+0x1123): undefined reference to cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' facedetect.cpp:(.text+0x11de): undefined reference tocv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)' facedetect.cpp:(.text+0x1247): undefined reference to cv::equalizeHist(cv::_InputArray const&, cv::_OutputArray const&)' facedetect.cpp:(.text+0x126a): undefined reference tocv::getTickCount()' facedetect.cpp:(.text+0x1310): undefined reference to cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::rect_<int>, std::allocator<cv::rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)' facedetect.cpp:(.text+0x1380): undefined reference tocv::flip(cv::InputArray const&, cv::OutputArray const&, int)' facedetect.cpp:(.text+0x1433): undefined reference to cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::rect_<int>, std::allocator<cv::rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)' facedetect.cpp:(.text+0x155f): undefined reference tocv::getTickCount()' facedetect.cpp:(.text+0x1599): undefined reference to cv::getTickFrequency()' facedetect.cpp:(.text+0x17dc): undefined reference tocv::circle(cv::InputOutputArray const&, cv::Point, int, cv::Scalar const&, int, int, int)' facedetect.cpp:(.text+0x191b): undefined reference to cv::rectangle(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' facedetect.cpp:(.text+0x193d): undefined reference tocv::CascadeClassifier::empty() const' facedetect.cpp:(.text+0x1a28): undefined reference to cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::rect_<int>, std::allocator<cv::rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)' facedetect.cpp:(.text+0x1bbf): undefined reference tocv::circle(cv::InputOutputArray const&, cv::Point, int, cv::Scalar const&, int, int, int)' facedetect.cpp:(.text+0x1c6d): undefined reference to cv::imshow(cv::String const&, cv::_InputArray const&)' /tmp/ccbH13my.o: In functioncv::String::String(char const)': facedetect.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4d): undefined reference to cv::String::allocate(unsigned long)' /tmp/ccbH13my.o: In functioncv::String::~String()': facedetect.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): undefined reference to cv::String::deallocate()' /tmp/ccbH13my.o: In functioncv::Mat::~Mat()': facedetect.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to cv::fastFree(void)' /tmp/ccbH13my.o: In functioncv::Mat::clone() const': facedetect.cpp:(.text._ZNK2cv3Mat5cloneEv[_ZNK2cv3Mat5cloneEv]+0x4e): undefined reference to cv::Mat::copyTo(cv::_OutputArray const&) const' /tmp/ccbH13my.o: In functioncv::Mat::release()': facedetect.cpp:(.text._ZN2cv3Mat7releaseEv[ZN2cv3Mat7releaseEv]+0x4b): undefined reference to cv::Mat::deallocate()' /tmp/ccbH13my.o: In functioncv::Mat::operator()(cv::Rect const&) const': facedetect.cpp:(.text._ZNK2cv3MatclERKNS_5Rect_IiEE[_ZNK2cv3MatclERKNS_5Rect_IiEE]+0x27): undefined reference to cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&)' /tmp/ccbH13my.o: In functioncv::Mat::operator=(cv::Mat&&)': facedetect.cpp:(.text.ZN2cv3MataSEOS0[ZN2cv3MataSEOS0]+0xe7): undefined reference to cv::fastFree(void)' /tmp/ccbH13my.o: In functioncv::String::String(std::__cxx11::basic_string<char, std::char_traits,="" std::allocator="" &gt;="" const&amp;)':="" facedetect.cpp:(.text._zn2cv6stringc2erknst7__cxx1112basic_stringicst11char_traitsicesaiceee[_zn2cv6stringc5erknst7__cxx1112basic_stringicst11char_traitsicesaiceee]+0x69):="" undefined="" reference="" to="" cv::string::allocate(unsigned="" long)'="" tmp="" ccbh13my.o:="" in="" functioncv::string="" cv::commandlineparser::getcv::string(cv::string="" const&amp;,="" bool)="" const':="" facedetect.cpp:(.text._znk2cv17commandlineparser3getins_6stringeeet_rks2_b[_znk2cv17commandlineparser3getins_6stringeeet_rks2_b]+0x51):="" undefined="" reference="" to="" cv::commandlineparser::getbyname(cv::string="" const&amp;,="" bool,="" int,="" void<em="">) const' /tmp/ccbH13my.o: In functiondouble cv::CommandLineParser::get(cv::String const&, bool) const': facedetect.cpp:(.text._ZNK2cv17CommandLineParser3getIdEET_RKNS_6StringEb[_ZNK2cv17CommandLineParser3getIdEET_RKNS_6StringEb]+0x49): undefined reference to `cv::CommandLineParser::getByName(cv::String const&, bool, int, void) const' collect2: error: ld returned 1 exit status#

I've installed OpenCV from source(github). While running cpp example it shows reference error Please help how to solve this problem.

System : Kubuntu 17.04 64bit Compiler: g++

click to hide/show revision 2
No.2 Revision

updated 2017-07-12 06:07:59 -0600

berak gravatar image

I found this error while running sample cpp example facedetect.cpp 'undefiend reference to cv:

/tmp/ccbH13my.o: In function main': facedetect.cpp:(.text+0x10e): undefined reference tocv::VideoCapture::VideoCapture()'
facedetect.cpp:(.text+0x14a): undefined reference to cv::CascadeClassifier::CascadeClassifier()' facedetect.cpp:(.text+0x159): undefined reference tocv::CascadeClassifier::CascadeClassifier()'
facedetect.cpp:(.text+0x192): undefined reference to cv::CommandLineParser::CommandLineParser(int, char const* const, const*, cv::String const&)' facedetect.cpp:(.text+0x1d0): undefined reference tocv::CommandLineParser::has(cv::String const&) const'
facedetect.cpp:(.text+0x36c): undefined reference to cv::CommandLineParser::has(cv::String const&) const' facedetect.cpp:(.text+0x3ff): undefined reference tocv::CommandLineParser::check() const'
facedetect.cpp:(.text+0x415): undefined reference to cv::CommandLineParser::printErrors() const' facedetect.cpp:(.text+0x44e): undefined reference tocv::CascadeClassifier::load(cv::String const&)'
facedetect.cpp:(.text+0x4bd): undefined reference to cv::CascadeClassifier::load(cv::String const&)' facedetect.cpp:(.text+0x5be): undefined reference tocv::VideoCapture::open(int)'
facedetect.cpp:(.text+0x66c): undefined reference to cv::imread(cv::String const&, int)' facedetect.cpp:(.text+0x6ec): undefined reference tocv::VideoCapture::open(cv::String const&)'
facedetect.cpp:(.text+0x77e): undefined reference to cv::imread(cv::String const&, int)' facedetect.cpp:(.text+0x7ff): undefined reference tocv::VideoCapture::isOpened() const'
facedetect.cpp:(.text+0x836): undefined reference to cv::VideoCapture::operator>>(cv::Mat&)' facedetect.cpp:(.text+0x8c3): undefined reference tocv::waitKey(int)'
facedetect.cpp:(.text+0x9b3): undefined reference to cv::waitKey(int)' facedetect.cpp:(.text+0xafa): undefined reference tocv::imread(cv::String const&, int)'
facedetect.cpp:(.text+0xb8b): undefined reference to cv::waitKey(int)' facedetect.cpp:(.text+0xc19): undefined reference tocv::CommandLineParser::~CommandLineParser()'
facedetect.cpp:(.text+0xc28): undefined reference to cv::CascadeClassifier::~CascadeClassifier()' facedetect.cpp:(.text+0xc37): undefined reference tocv::CascadeClassifier::~CascadeClassifier()'
facedetect.cpp:(.text+0xc73): undefined reference to cv::VideoCapture::~VideoCapture()' facedetect.cpp:(.text+0xe0e): undefined reference tocv::CommandLineParser::~CommandLineParser()'
facedetect.cpp:(.text+0xe22): undefined reference to cv::CascadeClassifier::~CascadeClassifier()' facedetect.cpp:(.text+0xe36): undefined reference tocv::CascadeClassifier::~CascadeClassifier()'
facedetect.cpp:(.text+0xe77): undefined reference to cv::VideoCapture::~VideoCapture()' /tmp/ccbH13my.o: In functiondetectAndDraw(cv::Mat&, cv::CascadeClassifier&, cv::CascadeClassifier&, double, bool)':
facedetect.cpp:(.text+0x1123): undefined reference to cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' facedetect.cpp:(.text+0x11de): undefined reference tocv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
facedetect.cpp:(.text+0x1247): undefined reference to cv::equalizeHist(cv::_InputArray const&, cv::_OutputArray const&)' facedetect.cpp:(.text+0x126a): undefined reference tocv::getTickCount()'
facedetect.cpp:(.text+0x1310): undefined reference to cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::rect_<int>, std::allocator<cv::rect_<int> std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)' facedetect.cpp:(.text+0x1380): undefined reference tocv::flip(cv::InputArray const&, cv::OutputArray const&, int)'
facedetect.cpp:(.text+0x1433): undefined reference to cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::rect_<int>, std::allocator<cv::rect_<int> std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)' facedetect.cpp:(.text+0x155f): undefined reference tocv::getTickCount()'
facedetect.cpp:(.text+0x1599): undefined reference to cv::getTickFrequency()' facedetect.cpp:(.text+0x17dc): undefined reference tocv::circle(cv::InputOutputArray const&, cv::Point, int, cv::Scalar const&, int, int, int)'
facedetect.cpp:(.text+0x191b): undefined reference to cv::rectangle(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' facedetect.cpp:(.text+0x193d): undefined reference tocv::CascadeClassifier::empty() const'
facedetect.cpp:(.text+0x1a28): undefined reference to cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::rect_<int>, std::allocator<cv::rect_<int> std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)' facedetect.cpp:(.text+0x1bbf): undefined reference tocv::circle(cv::InputOutputArray const&, cv::Point, int, cv::Scalar const&, int, int, int)'
facedetect.cpp:(.text+0x1c6d): undefined reference to cv::imshow(cv::String const&, cv::_InputArray const&)' /tmp/ccbH13my.o: In functioncv::String::String(char const)':
const*)':
facedetect.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4d): undefined reference to cv::String::allocate(unsigned long)' /tmp/ccbH13my.o: In functioncv::String::~String()':
facedetect.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): undefined reference to cv::String::deallocate()' /tmp/ccbH13my.o: In functioncv::Mat::~Mat()':
facedetect.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to cv::fastFree(void)' cv::fastFree(void*)' /tmp/ccbH13my.o: In functioncv::Mat::clone() const':
facedetect.cpp:(.text._ZNK2cv3Mat5cloneEv[_ZNK2cv3Mat5cloneEv]+0x4e): undefined reference to cv::Mat::copyTo(cv::_OutputArray const&) const' /tmp/ccbH13my.o: In functioncv::Mat::release()':
facedetect.cpp:(.text._ZN2cv3Mat7releaseEv[ZN2cv3Mat7releaseEv]+0x4b): undefined reference to cv::Mat::deallocate()' /tmp/ccbH13my.o: In functioncv::Mat::operator()(cv::Rect const&) const':
facedetect.cpp:(.text._ZNK2cv3MatclERKNS_5Rect_IiEE[_ZNK2cv3MatclERKNS_5Rect_IiEE]+0x27): undefined reference to cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&)' /tmp/ccbH13my.o: In functioncv::Mat::operator=(cv::Mat&&)':
facedetect.cpp:(.text.ZN2cv3MataSEOS0[ZN2cv3MataSEOS0]+0xe7): undefined reference to cv::fastFree(void)' cv::fastFree(void*)' /tmp/ccbH13my.o: In functioncv::String::String(std::__cxx11::basic_string<char, std::char_traits,="" std::allocator="" &gt;="" const&amp;)':="" facedetect.cpp:(.text._zn2cv6stringc2erknst7__cxx1112basic_stringicst11char_traitsicesaiceee[_zn2cv6stringc5erknst7__cxx1112basic_stringicst11char_traitsicesaiceee]+0x69):="" undefined="" reference="" to="" cv::string::allocate(unsigned="" long)'="" tmp="" ccbh13my.o:="" in="" functioncv::string="" cv::commandlineparser::getcv::string(cv::string="" const&amp;,="" bool)="" const':="" facedetect.cpp:(.text._znk2cv17commandlineparser3getins_6stringeeet_rks2_b[_znk2cv17commandlineparser3getins_6stringeeet_rks2_b]+0x51):="" undefined="" reference="" to="" cv::commandlineparser::getbyname(cv::string="" const&amp;,="" bool,="" int,="" void<em="">) std::char_traits, std::allocator > const&)':
facedetect.cpp:(.text._ZN2cv6StringC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN2cv6StringC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x69): undefined reference to cv::String::allocate(unsigned long)' /tmp/ccbH13my.o: In functioncv::String cv::CommandLineParser::getcv::String(cv::String const&, bool) const':
facedetect.cpp:(.text._ZNK2cv17CommandLineParser3getINS_6StringEEET_RKS2_b[_ZNK2cv17CommandLineParser3getINS_6StringEEET_RKS2_b]+0x51): undefined reference to cv::CommandLineParser::getByName(cv::String const&, bool, int, void*) const' /tmp/ccbH13my.o: In functiondouble cv::CommandLineParser::get(cv::String const&, bool) const':
facedetect.cpp:(.text._ZNK2cv17CommandLineParser3getIdEET_RKNS_6StringEb[_ZNK2cv17CommandLineParser3getIdEET_RKNS_6StringEb]+0x49): undefined reference to `cv::CommandLineParser::getByName(cv::String const&, bool, int, void) void*) const'
collect2: error: ld returned 1 exit status#

status#

I've installed OpenCV from source(github). While running cpp example it shows reference error Please help how to solve this problem.

System : Kubuntu 17.04 64bit Compiler: g++

click to hide/show revision 3
retagged

I found this error while running sample cpp example facedetect.cpp 'undefiend reference to cv:

/tmp/ccbH13my.o: In function main': facedetect.cpp:(.text+0x10e): undefined reference tocv::VideoCapture::VideoCapture()'
facedetect.cpp:(.text+0x14a): undefined reference to cv::CascadeClassifier::CascadeClassifier()' facedetect.cpp:(.text+0x159): undefined reference tocv::CascadeClassifier::CascadeClassifier()'
facedetect.cpp:(.text+0x192): undefined reference to cv::CommandLineParser::CommandLineParser(int, char const* const*, cv::String const&)' facedetect.cpp:(.text+0x1d0): undefined reference tocv::CommandLineParser::has(cv::String const&) const'
facedetect.cpp:(.text+0x36c): undefined reference to cv::CommandLineParser::has(cv::String const&) const' facedetect.cpp:(.text+0x3ff): undefined reference tocv::CommandLineParser::check() const'
facedetect.cpp:(.text+0x415): undefined reference to cv::CommandLineParser::printErrors() const' facedetect.cpp:(.text+0x44e): undefined reference tocv::CascadeClassifier::load(cv::String const&)'
facedetect.cpp:(.text+0x4bd): undefined reference to cv::CascadeClassifier::load(cv::String const&)' facedetect.cpp:(.text+0x5be): undefined reference tocv::VideoCapture::open(int)'
facedetect.cpp:(.text+0x66c): undefined reference to cv::imread(cv::String const&, int)' facedetect.cpp:(.text+0x6ec): undefined reference tocv::VideoCapture::open(cv::String const&)'
facedetect.cpp:(.text+0x77e): undefined reference to cv::imread(cv::String const&, int)' facedetect.cpp:(.text+0x7ff): undefined reference tocv::VideoCapture::isOpened() const'
facedetect.cpp:(.text+0x836): undefined reference to cv::VideoCapture::operator>>(cv::Mat&)' facedetect.cpp:(.text+0x8c3): undefined reference tocv::waitKey(int)'
facedetect.cpp:(.text+0x9b3): undefined reference to cv::waitKey(int)' facedetect.cpp:(.text+0xafa): undefined reference tocv::imread(cv::String const&, int)'
facedetect.cpp:(.text+0xb8b): undefined reference to cv::waitKey(int)' facedetect.cpp:(.text+0xc19): undefined reference tocv::CommandLineParser::~CommandLineParser()'
facedetect.cpp:(.text+0xc28): undefined reference to cv::CascadeClassifier::~CascadeClassifier()' facedetect.cpp:(.text+0xc37): undefined reference tocv::CascadeClassifier::~CascadeClassifier()'
facedetect.cpp:(.text+0xc73): undefined reference to cv::VideoCapture::~VideoCapture()' facedetect.cpp:(.text+0xe0e): undefined reference tocv::CommandLineParser::~CommandLineParser()'
facedetect.cpp:(.text+0xe22): undefined reference to cv::CascadeClassifier::~CascadeClassifier()' facedetect.cpp:(.text+0xe36): undefined reference tocv::CascadeClassifier::~CascadeClassifier()'
facedetect.cpp:(.text+0xe77): undefined reference to cv::VideoCapture::~VideoCapture()' /tmp/ccbH13my.o: In functiondetectAndDraw(cv::Mat&, cv::CascadeClassifier&, cv::CascadeClassifier&, double, bool)':
facedetect.cpp:(.text+0x1123): undefined reference to cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' facedetect.cpp:(.text+0x11de): undefined reference tocv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)'
facedetect.cpp:(.text+0x1247): undefined reference to cv::equalizeHist(cv::_InputArray const&, cv::_OutputArray const&)' facedetect.cpp:(.text+0x126a): undefined reference tocv::getTickCount()'
facedetect.cpp:(.text+0x1310): undefined reference to cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)' facedetect.cpp:(.text+0x1380): undefined reference tocv::flip(cv::InputArray const&, cv::OutputArray const&, int)'
facedetect.cpp:(.text+0x1433): undefined reference to cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)' facedetect.cpp:(.text+0x155f): undefined reference tocv::getTickCount()'
facedetect.cpp:(.text+0x1599): undefined reference to cv::getTickFrequency()' facedetect.cpp:(.text+0x17dc): undefined reference tocv::circle(cv::InputOutputArray const&, cv::Point, int, cv::Scalar const&, int, int, int)'
facedetect.cpp:(.text+0x191b): undefined reference to cv::rectangle(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)' facedetect.cpp:(.text+0x193d): undefined reference tocv::CascadeClassifier::empty() const'
facedetect.cpp:(.text+0x1a28): undefined reference to cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)' facedetect.cpp:(.text+0x1bbf): undefined reference tocv::circle(cv::InputOutputArray const&, cv::Point, int, cv::Scalar const&, int, int, int)'
facedetect.cpp:(.text+0x1c6d): undefined reference to cv::imshow(cv::String const&, cv::_InputArray const&)' /tmp/ccbH13my.o: In functioncv::String::String(char const*)':
facedetect.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x4d): undefined reference to cv::String::allocate(unsigned long)' /tmp/ccbH13my.o: In functioncv::String::~String()':
facedetect.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): undefined reference to cv::String::deallocate()' /tmp/ccbH13my.o: In functioncv::Mat::~Mat()':
facedetect.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to cv::fastFree(void*)' /tmp/ccbH13my.o: In functioncv::Mat::clone() const':
facedetect.cpp:(.text._ZNK2cv3Mat5cloneEv[_ZNK2cv3Mat5cloneEv]+0x4e): undefined reference to cv::Mat::copyTo(cv::_OutputArray const&) const' /tmp/ccbH13my.o: In functioncv::Mat::release()':
facedetect.cpp:(.text._ZN2cv3Mat7releaseEv[ZN2cv3Mat7releaseEv]+0x4b): undefined reference to cv::Mat::deallocate()' /tmp/ccbH13my.o: In functioncv::Mat::operator()(cv::Rect const&) const':
facedetect.cpp:(.text._ZNK2cv3MatclERKNS_5Rect_IiEE[_ZNK2cv3MatclERKNS_5Rect_IiEE]+0x27): undefined reference to cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&)' /tmp/ccbH13my.o: In functioncv::Mat::operator=(cv::Mat&&)':
facedetect.cpp:(.text.ZN2cv3MataSEOS0[ZN2cv3MataSEOS0]+0xe7): undefined reference to cv::fastFree(void*)' /tmp/ccbH13my.o: In functioncv::String::String(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)':
facedetect.cpp:(.text._ZN2cv6StringC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN2cv6StringC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x69): undefined reference to cv::String::allocate(unsigned long)' /tmp/ccbH13my.o: In functioncv::String cv::CommandLineParser::getcv::String(cv::String const&, bool) const':
facedetect.cpp:(.text._ZNK2cv17CommandLineParser3getINS_6StringEEET_RKS2_b[_ZNK2cv17CommandLineParser3getINS_6StringEEET_RKS2_b]+0x51): undefined reference to cv::CommandLineParser::getByName(cv::String const&, bool, int, void*) const' /tmp/ccbH13my.o: In functiondouble cv::CommandLineParser::get(cv::String const&, bool) const':
facedetect.cpp:(.text._ZNK2cv17CommandLineParser3getIdEET_RKNS_6StringEb[_ZNK2cv17CommandLineParser3getIdEET_RKNS_6StringEb]+0x49): undefined reference to `cv::CommandLineParser::getByName(cv::String const&, bool, int, void*) const'
collect2: error: ld returned 1 exit status#

I've installed OpenCV from source(github). While running cpp example it shows reference error Please help how to solve this problem.

System : Kubuntu 17.04 64bit Compiler: g++