Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV version 3.4 undefined reference to `cv::bgsegm::createBackgroundSubtractorMOG(int, int, double, double)'

Hello everyone, The OpenCV version I'm currently using is OpenCV 3.4 .

I'm trying to compile a sample program from github. But, I'm receiving the following errors: /tmp/cctdl0lP.o: In function createBGSubtractorByName(cv::String const&)': bgfg.cpp:(.text+0xfd): undefined reference tocv::bgsegm::createBackgroundSubtractorGMG(int, double)' bgfg.cpp:(.text+0x190): undefined reference to cv::bgsegm::createBackgroundSubtractorCNT(int, bool, int, bool)' bgfg.cpp:(.text+0x2b8): undefined reference tocv::bgsegm::createBackgroundSubtractorMOG(int, int, double, double)' collect2: error: ld returned 1 exit status

I found the similar problem referred here. And hence I included the following:

ifdef _DEBUG

pragma comment(lib, "opencv_bgsegm340d.lib")

else

pragma comment(lib, "opencv_bgsegm340.lib")

endif

Yet, the problem doesn't seem to be solved. Kindly, help.

Thanks in advance.

OpenCV version 3.4 undefined reference to `cv::bgsegm::createBackgroundSubtractorMOG(int, int, double, double)'

Hello everyone, The OpenCV version I'm currently using is OpenCV 3.4 .

I'm trying to compile a sample program from github. But, I'm receiving the following errors:

/tmp/cctdl0lP.o: In function createBGSubtractorByName(cv::String `createBGSubtractorByName(cv::String const&)':
bgfg.cpp:(.text+0xfd): undefined reference tocv::bgsegm::createBackgroundSubtractorGMG(int, to `cv::bgsegm::createBackgroundSubtractorGMG(int, double)'
bgfg.cpp:(.text+0x190): undefined reference to cv::bgsegm::createBackgroundSubtractorCNT(int, `cv::bgsegm::createBackgroundSubtractorCNT(int, bool, int, bool)'
bgfg.cpp:(.text+0x2b8): undefined reference tocv::bgsegm::createBackgroundSubtractorMOG(int, to `cv::bgsegm::createBackgroundSubtractorMOG(int, int, double, double)'
collect2: error: ld returned 1 exit status

status

I found the similar problem referred here. And hence I included the following:

ifdef _DEBUG

#ifdef _DEBUG                    #pragma comment(lib, "opencv_bgsegm340d.lib")  

pragma #else #pragma comment(lib, "opencv_bgsegm340d.lib")

"opencv_bgsegm340.lib")

else

pragma comment(lib, "opencv_bgsegm340.lib")

endif

#endif

Yet, the problem doesn't seem to be solved. Kindly, help.

Thanks in advance.