Or we can use pkg-config like it's 2017... $ pkg-config --libs zlib -lz $ pkg-config --cflags zlib $