Skip to content

[windows] Using zlib and freetype static libraries causes LNK2005/LNK4006

ubawurinna requested to merge (removed):windows_static_lib into master

In the ftoption.h file the comment for the FT_CONFIG_OPTION_SYSTEM_ZLIB option states:
If you let it undefined, the component will use its own copy of the zlib sources instead. These have been modified to be included directly within the component and not export external function names. This allows you to link any program with FreeType and ZLib without linking conflicts.

But on windows when linking both static libraries files freetype.lib and zlib.lib, errors are generated because freetype zlib functions are exported.

The solution is to declare zlib functions as static for visual studio as it is done when using a gnu or clang compiler.
Or to do this for all compilers.

Merge request reports