18

Trying to link against a static assimp library which I built with MinGW. Here are the errors I'm getting:

H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(BlenderLoader.cpp.obj):BlenderLoader.cpp:(.text+0xd91): undefined reference to inflateInit2_' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(BlenderLoader.cpp.obj):BlenderLoader.cpp:(.text+0xe06): undefined reference toinflate' H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(BlenderLoader.cpp.obj):BlenderLoader.cpp:(.text+0xf72): undefined reference to inflateEnd' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XGLLoader.cpp.obj):XGLLoader.cpp:(.text+0x76c): undefined reference toinflateInit2_' H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XGLLoader.cpp.obj):XGLLoader.cpp:(.text+0x7ff): undefined reference to inflate' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XGLLoader.cpp.obj):XGLLoader.cpp:(.text+0x953): undefined reference toinflateEnd' H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x9ac): undefined reference to inflateInit2_' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0xd5c): undefined reference toinflate' H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0xed2): undefined reference to inflateReset' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0xef8): undefined reference toinflateSetDictionary' H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0xf52): undefined reference to inflateEnd' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x1b4a): undefined reference toinflateInit2_' H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x1efa): undefined reference to inflate' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x2070): undefined reference toinflateReset' H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x2096): undefined reference to inflateSetDictionary' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x20f0): undefined reference toinflateEnd' H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x1935): undefined reference to inflateInit2_' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x19b8): undefined reference toget_crc_table' H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x1ec2): undefined reference to crc32' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x1f67): undefined reference toinflate' H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x1fb5): undefined reference to crc32' H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x2245): undefined reference toinflateEnd'

SteveDeFacto
  • 1,317
  • 4
  • 19
  • 35
  • 1
    Did you include all header files? – jrad Jul 23 '12 at 03:30
  • Just to make a note, my download of assimp included the source of zlib and provided an option to build the included version. I got these same errors until I configured the assimp project to build a fresh copy of zlib, and then had to include this in my application. – parker.sikand Oct 22 '16 at 23:57
  • related: https://stackoverflow.com/questions/1632201/error-deflate-and-inflate-with-zlib – Ciro Santilli OurBigBook.com Oct 23 '17 at 07:56

1 Answers1

25

Those are functions in the zlib library. Do you have zlib.h and the zlib library (.a or .lib) and the paths set correctly

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
  • Thank you it works perfectly now! I didn't have to link to zlib before when I compiled assimp as static for visual c++. – SteveDeFacto Jul 23 '12 at 13:31
  • Is it possible to include the `zlib.lib` file into the `assimp.lib` so that I only need to include the latter in my actual project? – danijar Mar 29 '13 at 20:00
  • 4
    @DragonLord makes very useful comment. It's call zlib, but on Linux the convention is to use the prefix 'lib' on libraries. Therefore, the file should be libz and the linker flag -lz – Donal Lafferty Sep 21 '14 at 13:21
  • 2
    I'm having this same issue but on Windows using MinGW make trying to build JLint, and I try to manually set the path to my libz.dll.a or libz.a but I still get these linker errors. Anyone have any ideas? – searchengine27 Jul 31 '15 at 15:50
  • FYI: figured it out. Turns out JLint's Makefile is not properly formed (for Windows?). It has the -l flag in the middle of the linker command, where it needed to be at the end of the linker command line. – searchengine27 Jul 31 '15 at 17:40
  • @MartinBeckett , how did you know it was function in the zlib? – juztcode Jul 06 '20 at 05:55