Question

I recently install a fedora 18 after few years under ubuntu.

After the apropriate updates, I download and recompile, my favorites libraries such as Opencv and PCL.

In order to check if everything was ok I tried to compile the folowing code :

cv::Mat im = cv::imread("023.JPG");

cv::resize(im.clone(),im,cv::Size(600,800));

cv::imshow("default",im);

cv::waitkey(0);

The compilation step look like have succed, but when I try to execute this code I got the following :

/home/jonny/Desktop/prog/MMSE_SD2/test_opencv-build-desktop-Qt_4_8_4_in_PATH_System_Release/test_opencv: symbol lookup error: /home/jonny/Desktop/prog/MMSE_SD2/test_opencv-build-desktop-Qt_4_8_4_in_PATH_System_Release/test_opencv: undefined symbol: _ZN2cv12_OutputArrayD1Ev

I use qtcreator as IDE.

My .pro file looklike this :

INCLUDEPATH +=/usr/local/include/opencv-2.4.9

LIBS += -lopencv_core \
 -lopencv_highgui \
 -lopencv_imgproc \
 -lopencv_calib3d \
 -lopencv_contrib \
 -lopencv_features2d \
 -lopencv_flann \
 -lopencv_legacy \
 -lopencv_ml \
 -lopencv_objdetect \
 -lopencv_video 

SOURCES += \
    main.cpp

I recompiled three time opencv library without success.

If someone can help I really appreciate.

Thanks in advance

Jonny

Was it helpful?

Solution

My assumption is that you have an older version of OpenCV installed in the system and your program is runtime-linked to the wrong libraries.

You can easily check this by calling ldd <binary>, which will list the libraries your binary will be linked to. If they are not the ones you installed in /usr/local/lib/, you may fix the issue by setting LD_LIBRARY_PATH.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top