OpenCV Display window title corrupted and multiple windows show

I had a very strange (and annoying problem) with an OpenCV project in VS2012, when my program created an image display window (namedWindow) I noticed that its window title was all garbled and soon afterwards other display windows were created even though the code had not requested them.

I spent a lot of time comparing the VS2012 projects settings with those of another working project and eventually found that I could make the problem go away by adding this to the ‘Preprocessor Definitions’ setting:


I have no idea at the moment why adding this fixed the problem but it did! I must have added it to the working project (which was born inside VS2010) but I can’t remember why!

7 replies
  1. Rajshekar Prabhakar
    Rajshekar Prabhakar says:

    1) Same as above
    2) Unable to load image into CV::Mat from a file, image size was 0 x 0 and
    Error: ” OpenCV Error: Assertion failed (size.width)0 && size.height)0) in cv::imshow, file C\builds\2_4_PackSlave-win64-vc12-shared\opencv\modules\highgui\src\window.cpp, line 261″ when trying to display image to window.

    Windows 8.1 x64
    OpenCV 2.4.8 with pre-built libs of VS 2012
    QtCreator 5.2 MSVC 2012 x64
    VS 2013 debugger

    Adding the below line in .pro file of Qt Creator project solved both the problems.


    Thank you!
    Rajshekar Prabhakar

  2. Trønder
    Trønder says:

    This also happened to solve errors causing the program to request the release versions of DLLs even though I was compiling for debug.

    Thank you!

Comments are closed.