VS 2015 C++ imwrite exception 0xC0000005
Dear all,
I am new to OpenCV and tried to create a simple opencv application using OpenCV31 under Visual Studio Community 2015. I created a C++ Win32 console application, here is my code:
int main(int argc, char* argv[])
{
Mat testImg(50, 50, CV_8U);
imwrite("C:\Users\Me\TestOut.jpg", testImg);
return 0;
}
But if I run this I get an access violation:
Exception at 0x00007FFAC9994D61 (opencv_world310.dll) 0xC0000005: Access violation on reading on position 0x00000201A183B000.
This happens if I use Visual Studio 2015 with Debug settings. If I switch to Release settings then the code works!?!
What goes wrong here?
Thanks for any help!
In Debug, the dll should be: opencv_world310d.dll