I am trying to run code that use zlib on Debian by using this command
gcc -o new double.c -lz -lm
But I have these errors : how to fix the errors please?
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
You need to install the library and the associated header files. This can be done using the following command:
sudo apt-get install zlib1g-dev
Note that you have indicated you have a file named zlib.h
in your project directory. This is wrong. Delete it, and use #include <zlib.h>
instead of #include "zlib.h"
. This will use the correct zlib.h
, the one installed by the above command.