C++ collect2.exe:错误:ld 返回 1 个退出状态
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24728476/
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
collect2.exe: error: ld returned 1 exit status
提问by user3695946
Please I need help when I try to compile my .C to png
请在我尝试将 .C 编译为 png 时需要帮助
gcc --std=c99 -Wall -lz a.c -o a.png
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lz
collect2.exe: error: ld returned 1 exit status
What does this mean?
这是什么意思?
回答by Ananya
From the error message, the linker says that it can not find libz.so
or libz.a
.
If you are providing that lib from your own path,
tell the linker that it has to search in your path, by
从错误消息中,链接器说它找不到libz.so
或libz.a
。如果您从自己的路径提供该库,请告诉链接器它必须在您的路径中搜索,通过
gcc --std=c99 -Wall -Ldir -lz a.c -o a.png
use
用
ld -lz --verbose
to see where linker has searched for libz.
查看链接器在何处搜索了 libz。