You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows 7 64 bit and Visual Studio 2015, I have built zlib 1.2.11 and now I am trying to build openexr which depends on zlib. But I met with errors as follows:
4> Generating Code...
4> Creating library C:/Users/Admin/Downloads/openexr-2.2.0/build/IlmImf/Release/IlmImf-2_2.lib and object C:/Users/Admin/Downloads/openexr-2.2.0/build/IlmImf/Release/IlmImf-2_2.exp
4>ImfDwaCompressor.obj : error LNK2019: unresolved external symbol compress2 referenced in function "private: int __cdecl Imf_2_2::DwaCompressor::compress(char const *,int,class Imath_2_2::Box<class Imath_2_2::Vec2<int> >,char const * &)" (?compress@DwaCompressor@Imf_2_2@@AEAAHPEBDHV?$Box@V?$Vec2@H@Imath_2_2@@@Imath_2_2@@AEAPEBD@Z)
4>ImfDwaCompressor.obj : error LNK2019: unresolved external symbol uncompress referenced in function "private: int __cdecl Imf_2_2::DwaCompressor::uncompress(char const *,int,class Imath_2_2::Box<class Imath_2_2::Vec2<int> >,char const * &)" (?uncompress@DwaCompressor@Imf_2_2@@AEAAHPEBDHV?$Box@V?$Vec2@H@Imath_2_2@@@Imath_2_2@@AEAPEBD@Z)
4>ImfPxr24Compressor.obj : error LNK2001: unresolved external symbol uncompress
4>ImfZip.obj : error LNK2001: unresolved external symbol uncompress
4>ImfPxr24Compressor.obj : error LNK2019: unresolved external symbol compress referenced in function "private: int __cdecl Imf_2_2::Pxr24Compressor::compress(char const *,int,class Imath_2_2::Box<class Imath_2_2::Vec2<int> >,char const * &)" (?compress@Pxr24Compressor@Imf_2_2@@AEAAHPEBDHV?$Box@V?$Vec2@H@Imath_2_2@@@Imath_2_2@@AEAPEBD@Z)
4>ImfZip.obj : error LNK2001: unresolved external symbol compress
4>C:\Users\Admin\Downloads\openexr-2.2.0\build\IlmImf\Release\IlmImf-2_2.dll : fatal error LNK1120: 3 unresolved externals
But the three functions compress2, uncompress and compress are exposed from zlib.lib. I can prove it by dumpbin:
OK, I found out where the problem is. I should use -DZLIB_ROOT="C:\Users\Admin\Downloads\OIIO\external\zlib-1.2.11" to specify the location of zlib, but I was misled by this link to use ZLIB_LIBRARY and ZLIB_INCLUDE_DIR for the same purpose, as you can see in my original thread. So, after correcting the cmake command, I got openexr as desired. To clarify, the correct cmake command is:
cmake -DILMBASE_PACKAGE_PREFIX:STRING=C:/Users/Admin/Downloads/OIIO/external/ilmbase-2.2.0 -DCMAKE_INSTALL_PREFIX:STRING=C:/Users/Admin/Downloads/OIIO/external/openexr-2.2.0 -DZLIB_ROOT="C:\Users\Admin\Downloads\OIIO\external\zlib-1.2.11" -G"Visual Studio 14 2015 Win64" ..
PS: I think nowadays at least 80% information in internet are wrong. Documents of some well-known libraries are still talking about 32 bit. Who is using 32 bit CPU today? I saw everyone use 64 bit OS more than 5 years ago. Sigh...
I think the ZLIB_LIBRARY variable should be set to a lib file like zlib.lib but I set it to the lib folder. Maybe that caused the problem. Anyway, ZLIB_ROOT saves us a lot of typing.
On Windows 7 64 bit and Visual Studio 2015, I have built zlib 1.2.11 and now I am trying to build openexr which depends on zlib. But I met with errors as follows:
But the three functions compress2, uncompress and compress are exposed from zlib.lib. I can prove it by dumpbin:
How to fix this issue? Was the linker trying to link zlib.lib or zlibstatic.lib which exposes nothing? Can I force openexr to link to zlib.lib?
The cmake command to config zlib is:
and the cmake command to config openexr is:
They look correct and I didn't change anything else. So how to link these 3 functions to openexr (or IlmImf)? Thanks a lot for your help!
The text was updated successfully, but these errors were encountered: