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!