如何修复 /usr/bin/ld: cannot find -lzlib
问题:
你想编译使用 zlib 的 C++ 可执行文件,但你看到类似这样的错误消息
output.txt
/usr/bin/ld: cannot find -lzlib
collect2: error: ld returned 1 exit status解决方案
使用 -lz 而不是 -lzlib。zlib 库命名为 libz.so,而不是 libzlib.so!
示例:
build.sh
g++ -o ztest zpipe.c -lzCheck out similar posts by category:
C/C++
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow