# linker errors - inflate already defined (assimp + freetype)

**URL:** https://discourse.cmake.org/t/linker-errors-inflate-already-defined-assimp-freetype/5600
**Category:** Code
**Tags:** os:windows, comp:msvc, gen:ninja
**Created:** [May 3, 2022, 12:52am UTC](https://discourse.cmake.org/t/linker-errors-inflate-already-defined-assimp-freetype/5600 "2022-05-03T00:52:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rystills](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/bc79bd/32.png) [@rystills](https://discourse.cmake.org/u/rystills)
#### Post date: [May 3, 2022, 12:52am UTC](https://discourse.cmake.org/t/linker-errors-inflate-already-defined-assimp-freetype/5600/1 "2022-05-03T00:52:49Z")

</div>

Hi there,  
I’m in the process of converting the following project from visual studio’s build system over to cmake: [GitHub - rystills/RaiderEngine at switchToCmake](https://github.com/rystills/RaiderEngine/tree/switchToCmake)  
The project relies on the following external dependencies:  
-glad  
-glfw  
-glm  
-OpenAL  
-assimp  
-freetype  
-PhysX  
To facilitate the build, I introduced a CMakeLists.txt at the root level (specifying the project name, build flags, and directories), a CMakeLists.txt in the source directory (specifying the source files and libraries to link), and a CMakeLists.txt in each dependency root (specifying that dependency’s build settings and additional includes).  
The transition to cmake was successful, with one exception: the linker complains that a number of methods named some variant of “inflate” are already defined (ex. Error | LNK2005 | inflate already defined in freetype.lib(ftgzip.c.obj) | …/x64-Release/RaiderEngine | …/x64-Release/RaiderEngine/zlibstatic.lib(inflate.c.obj)).  
As far as I can tell both assimp and freetype rely on zlib, and these errors only manifest when both libraries are linked, but I have no idea how to resolve them. I tried enabling the BUILD\_SHARED\_LIBS flag to no effect, and I can’t seem to find any similar issues online to refer to. I’m hoping that someone here may be able to shed some light on this issue for me. Any help will be greatly appreciated.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 3, 2022, 11:37am UTC](https://discourse.cmake.org/t/linker-errors-inflate-already-defined-assimp-freetype/5600/2 "2022-05-03T11:37:38Z")

</div>

It looks like freetype embeds zlib on Windows without mangling. You’ll probably need to convince it to use the same zlib as everything else is using.

---

<div class="post-metadata">

### Author: ![rystills](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/bc79bd/32.png) [@rystills](https://discourse.cmake.org/u/rystills)
#### Post date: [May 7, 2022, 5:31am UTC](https://discourse.cmake.org/t/linker-errors-inflate-already-defined-assimp-freetype/5600/3 "2022-05-07T05:31:59Z")

</div>

Thank you for the advice; your suggestion put me on the right path. I ultimately realized that I had mistakenly enabled the BUILD\_SHARED\_LIBS flag for the wrong configuration. Applying the flag to my current configuration enabled freetype and assimp to compile and link without issue, so I won’t be investigating the issue further at this time.
