In case someone gets here... I got this issue and the reason was that I was linking with the release version of the OpenCV library instead of the debug version in my Debug configuration.