I have built zlib with vcpkg. I have tried several variants, like:
vcpkg install zlib
vcpkg install zlib:x86-windows-static
vcpkg install zlib:x64-windows-static
Now, I have a simple minizip demo and I want to use the static zlib (zlib.lib) that I built.
In x64 mode, all is linking correctly against x64 zlib. However, in x86 mode, I have these errors for the x86 zlib library:
1>mz_crypt.obj : error LNK2019: unresolved external symbol _crc32@12 referenced in function _mz_crypt_crc32_update
1>mz_strm_zlib.obj : error LNK2019: unresolved external symbol _deflate@8 referenced in function _mz_stream_zlib_deflate
1>mz_strm_zlib.obj : error LNK2019: unresolved external symbol _deflateEnd@4 referenced in function _mz_stream_zlib_close
1>mz_strm_zlib.obj : error LNK2019: unresolved external symbol _inflate@8 referenced in function _mz_stream_zlib_read
1>mz_strm_zlib.obj : error LNK2019: unresolved external symbol _inflateEnd@4 referenced in function _mz_stream_zlib_close
1>mz_strm_zlib.obj : error LNK2019: unresolved external symbol _deflateInit2_@32 referenced in function _mz_stream_zlib_open
1>mz_strm_zlib.obj : error LNK2019: unresolved external symbol _inflateInit2_@16 referenced in function _mz_stream_zlib_open
I am using these preprocesor macros:
ZLIB_WINAPI
HAVE_ZLIB
MZ_ZIP_NO_ENCRYPTION
and code generation is set to: Multi-threaded Debug (/MTd)
.
For future readers, I have solved this by removing
ZLIB_WINAPI
for x86 build.