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...
Qt Code:
  1. INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include
  2. INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include/opencv
  3.  
  4. LIBS += -LC:/Programs/OpenCV-2.4.2/mybuildmingw/install/lib \
  5. -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:
Qt Code:
  1. INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include
  2. INCLUDEPATH += C:/Programs/OpenCV-2.4.2/mybuildmingw/install/include/opencv
  3.  
  4. LIBS += -LC:/Programs/OpenCV-2.4.2/mybuild/lib/Debug \
  5. -lopencv_highgui242d
To copy to clipboard, switch view to plain text mode 

And program is working with code:
Qt Code:
  1. IplImage* img = cvLoadImage( "C:\\opencv.png" );
  2. cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
  3. cvShowImage("Example1", img);
  4. cvWaitKey(0);
  5. 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:
Qt Code:
  1. c:\Programs\OpenCV-2.4.2\mybuildmingw\install\include\opencv2\core\mat.hpp:278: błąd:undefined reference to `cv::fastFree(void*)'
  2. c:\Programs\OpenCV-2.4.2\mybuildmingw\install\include\opencv2\core\mat.hpp:367: błąd:undefined reference to `cv::Mat::deallocate()'
  3. :-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...