user3695946
user3695946

Reputation: 47

collect2.exe: error: ld returned 1 exit status

Please I need help when I try to compile my .C to 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?

Upvotes: 3

Views: 31388

Answers (1)

Ananya
Ananya

Reputation: 11

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

gcc --std=c99 -Wall -Ldir -lz a.c -o a.png

use

ld -lz --verbose 

to see where linker has searched for libz.

Upvotes: 0

Related Questions