views:

105

answers:

1

I am using VS2010 and opencv2.1. Under Win7, the sample programme is below:

#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

int main(int argc, char* argv[])

{

        IplImage *img = cvLoadImage("funny-pictures-cat-goes-pew.jpg");
        cvNamedWindow("Image:",1);
        cvShowImage("Image:",img); 
        cvWaitKey();
        cvDestroyWindow("Image:");
        cvReleaseImage(&img);
        return 0;
}

The programme failed to start. I see:

The application was unable to start correctly(0xc0150002). Click OK to close the application.

Why?

A: 

Is this the same machine where the compiler is installed? If not, did you install the VS2010 redistributable runtime along with your own program?

Ben Voigt
Don't forget to include the correct version of OpenCV dlls! (If your program is 64-bit, you must use the 64-bit DLLs) `cxcore210.dll, cv210.dll, highgui210.dll`
rwong
A helpful tool is Dependency Walker http://www.dependencywalker.com/
rwong
it is not the same machine where my vc compiler is installed.
Tracy
actually, the libs and dlls was compiled using vc2008 under windows xp.
Tracy
maybe installiing the vs2010 redistributable runtime will help, i will have a try
Tracy
If you have a main program compiled with VC2010 and libraries compiled with VC2008, you will probably need both the VC2010 runtime and the VC2008 SP1 runtime installed.
Ben Voigt