I have a problem that I can't figure out. My project using the OpenEXR library is perfectly working on the Linux platform. It has to be compilable also in Visual Studio 2015. Hence I'm trying to port it. I have successfully compiled and installed OpenEXR 2.2.0 release (downloaded from the official site, following instructions at GitHub). Unfortunately I'm hitting several issues with my code. One of them can be simplified to the following small snippet:
#include <OpenEXR/ImfInputFile.h>
#include <OpenEXR/ImfHeader.h>
int main(int argc, char * argv[]) {
Imf::InputFile exr_file("test.exr");
const Imf::Header & exr_header = exr_file.header();
// e.g. this fails at debug assertion: map/set iterators incompatible
bool test1 = exr_header.begin() != exr_header.end();
// or this gets stuck somehow and consuming CPU, the program doesn't continue
bool test2 = exr_header.begin() != exr_header.begin();
return 0;
}
When it is compiled in the Release mode it seems to be fine (at least for the snippet, my project has some other issues which I suspect to be related). But in the Debug mode, which I need to debug my project, strange things occur. The first test ends with a debug assertion:
Debug Assertion Failed!
Program: C:\WINDOWS\SYSTEM32\MSVCP140D.dll
File: c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtree
Line: 326
Expression: map/set iterators incompatible
The second one (when the first is commented out) gets stuck and the program seems like to be in an endless loop. I don't understand why.
Please, can somebody help me? I'm using Visual Studio Community 2015 if that matters.