Undefined reference to 'inflateInit2_'

泄露秘密 提交于 2019-11-28 03:35:05

问题


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?


回答1:


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

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




回答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



来源:https://stackoverflow.com/questions/20593423/undefined-reference-to-inflateinit2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!