I had issues getting a prebuilt version of OpenEXR working properly in my project so I decided to just build it myself, I ran into a couple of issues so I’ve quickly summarised them here incase anyone else has the same problem. In my case, I needed it to work on Windows 7 in Visual Studio 2013.

IlmBase Libs

IlmImf and other projects will complain about an error like this:

error MSB6006: "cmd.exe" exited with code -1073741515.

As explained in this Stack Overflow post, you have to manually copy the IlmBase libs (Half, IlmImf, Imath etc) into the OpenExr release/debug build directory  to successfully build.

Zlib unistd.h error

After I fixed that, I then got compile errors from within Zlib related to unistd.h being missing on Windows. Again, Stack Overflow saved my bacon and explained that you need to edit line 287 in zconf.h, changing

#if 1

to

#if HAVE_UNISTD_H

 

After this I managed to build it properly and use it in my project.