4

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?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
user3695946
  • 49
  • 1
  • 1
  • 4

1 Answers1

0

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.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Ananya
  • 11