Undefined reference to 'inflateInit2_'

28,407

Solution 1

Use the option -L<path> to tell the linker where to find libz.so.x.y.z.

For your reference: http://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html

Solution 2

you can see where your zlib is installed like this :

/sbin/ldconfig -p| grep libz.so

it should find one or more entries if installed, otherwise it will return blank line

Share:
28,407
Jake
Author by

Jake

Updated on July 09, 2022

Comments

  • Jake
    Jake almost 2 years

    I'm using Code Blocks IDE and I want to install Tiled Map Editor for SFML. So, I downloaded the source and imported it to my project. Unfortunately, the build finished with an error due to missing zlib library. I downloaded it and built again. This time I received an error that reads:

    undefined reference to `inflateInit2_'|
    undefined reference to `inflateEnd'|
    undefined reference to `inflateEnd'|
    

    On the Internet I found the advice to join the linker command -lz, but the compiler refuses throwing the error: cannot find -lz. Does anyone know how to fix it?

  • alk
    alk over 7 years
    This would suite as comment, but does not answer the question.
  • serup
    serup over 7 years
    Yes so it seems