Hi,
I'll describe my problem with linking OpenCV 2.4.2 in Qt. I have build source OpenCV with two compilers MVSC 10 and MinGW and tried to link libraries with Qt.
1) First of all, I've tried to link libraries builded with MinGW (and cmake). But I found out, that there's no "*.lib" files only "*.dll.a". So in *.pro I've tried to link those "dll.a" files, but it don't work...
INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include
INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include/opencv
LIBS += -LC:/Programs/OpenCV-2.4.2/mybuildmingw/install/lib \
-llibopencv_highgui242
INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include
INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include/opencv
LIBS += -LC:/Programs/OpenCV-2.4.2/mybuildmingw/install/lib \
-llibopencv_highgui242
To copy to clipboard, switch view to plain text mode
It shows "exited with code -1073741511", so it's definitely a dll linking problem. I've tried to write "-llibopencv_highgui242.a" and "-llibopencv_highgui242.dll" and "-llibopencv_highgui242.dll.a" but nothing is working...
2) Next, I tried to link libraries builded with MVSC 10. Here are "*.lib" files so it was good with code:
INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include
INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include/opencv
LIBS += -LC:/Programs/OpenCV-2.4.2/mybuild/lib/Debug \
-lopencv_highgui242d
INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include
INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include/opencv
LIBS += -LC:/Programs/OpenCV-2.4.2/mybuild/lib/Debug \
-lopencv_highgui242d
To copy to clipboard, switch view to plain text mode
And program is working with code:
IplImage* img = cvLoadImage( "C:\\opencv.png" );
cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage(&img);
IplImage* img = cvLoadImage( "C:\\opencv.png" );
cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage(&img);
To copy to clipboard, switch view to plain text mode
But if I only want to use something connected with VideoCapture or Mat for example "cv::Mat I;" if gives me the compiling error:
c:\Programs\OpenCV-2.4.2\mybuildmingw\install\include\opencv2\core\mat.hpp:278: błąd:undefined reference to `cv::fastFree(void*)'
c:\Programs\OpenCV-2.4.2\mybuildmingw\install\include\opencv2\core\mat.hpp:367: błąd:undefined reference to `cv::Mat::deallocate()'
:-1: błąd:collect2: ld returned 1 exit status
c:\Programs\OpenCV-2.4.2\mybuildmingw\install\include\opencv2\core\mat.hpp:278: błąd:undefined reference to `cv::fastFree(void*)'
c:\Programs\OpenCV-2.4.2\mybuildmingw\install\include\opencv2\core\mat.hpp:367: błąd:undefined reference to `cv::Mat::deallocate()'
:-1: błąd:collect2: ld returned 1 exit status
To copy to clipboard, switch view to plain text mode
Do you have any ideas how to solve this problem? I would really apreciate it, because I'm fighting with it whole week...
Bookmarks