I downloaded opencv 2.4.5 and tried to configure in Visual studio 11. I tried compiling the below code in Debug mode by following the steps from this link. It works fine.

But the same code get crahes in release mode.

The below is the code.

#include "stdafx.h"
#include <opencv2/opencv.hpp>

using namespace cv;

int main()
{
    Mat img(Mat::zeros(100, 100, CV_8U));

    imshow("window", img);

    waitKey();

    return 0;
}
有帮助吗?

解决方案

As my guess, there may be a linkage problem. For release mode you need to link with release static libraries For example, if a debug library is opencv_imgproc243d.lib, its release version is opencv_imgproc243.lib

其他提示

Try putting the OpenCV .dll files in your executable folder.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top