C++ 对“inflateInit2_”的未定义引用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20593423/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 23:14:00  来源:igfitidea点击:

Undefined reference to 'inflateInit2_'

c++windowsgcczlibundefined-reference

提问by Jake

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:

我正在使用代码块 IDE,我想为 SFML 安装 Tiled Map Editor。所以,我下载了源代码并将其导入到我的项目中。不幸的是,由于缺少 zlib 库,构建完成时出现错误。我下载并重新构建。这次我收到一个错误消息:

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?

在互联网上我找到了加入链接器命令的建议-lz,但编译器拒绝抛出错误:找不到 -lz。有谁知道如何修理它?

采纳答案by alk

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

使用该选项-L<path>告诉链接器在哪里可以找到libz.so.x.y.z.

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

供您参考:http: //gcc.gnu.org/onlinedocs/gcc/Directory-Options.html

回答by serup

you can see where your zlib is installed like this :

您可以像这样查看 zlib 的安装位置:

/sbin/ldconfig -p| grep libz.so

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

如果安装,它应该找到一个或多个条目,否则它将返回空行