I'm currently trying to play around with OpenCV but I ran into a bit of trouble.. I use the qt ide with mingw to compile my applications.
My code looks like this:
#include “highgui.h”
int main( int argc, char** argv )
{
IplImage* img1 = cvLoadImage( argv[1] );
cvNamedWindow( “Example”, CV_WINDOW_AUTOSIZE );
cvShowImage( “Example”, img1 );
cvWaitKey(0);
cvReleaseImage( &img1 );
cvDestroyWindow( “Example” );
return(0);
}
And this is in my .pro file:
INCLUDEPATH += "E:/OpenCV2MinGWBuild/install/include/"
INCLUDEPATH += "E:/OpenCV2MinGWBuild/install/include/opencv/"
INCLUDEPATH += "E:/OpenCV2MinGWBuild/install/include/opencv2/"
LIBS += -L"E:/OpenCV2MinGWBuild/install/lib/" -lopencv_calib3d231.dll -lopencv_contrib231.dll -lopencv_core231.dll
The libraries are .a-s(the dll is in the name part of the lib, it's not an extension).. I know that .a libraries are linux specific but mingw sould be able to use them right?
I built the OpenCV libraries with mingw, but I can't get them to link to my Qt application..
MinGW can see the header files just fine, but not the libraries.
I always get "undefined reference to cvShowImage'", "undefined reference to
cvNamedWindow'" (etc)errors..
Any help is appreciated! Thnx!
The dll.a are not static library files they are stubs for the dynamic linked .dll
- you need to rebuild OpenCv to use static libs .lib
and link those directly with your code