I am trying to compile existing code provided in examples by zlib, but it is giving me error at the first place itself:
zlib
nikhil@nikhil-Vostro-350
You're getting a linker error because you haven't told the compiler to link the library that contains the functions that you've used. The usual way of compiling a simple program that uses zlib on Ubuntu would be:
gcc -o foo foo.c -lz