Undefined link to the `gzopen` error

My C uses some zlib functions (e.g. gzopen , gzread ). I included the zlib.h header file in my program and added the -lz when compiling, but I still get the error message that the gz functions have undefined links. I am using kubuntu 11.10 and installed the following packages: libgh-zlib-dev, zlib1g-dbg, zlib1g and zlib1g-dev.

I tried to change the position of the binding team, but no luck. Here is the one I have at the moment:

CFLAGS = -Wall -pthread -lm -lz -std = c99 -Wextra

+7
source share
1 answer

put them as part of LDFLAGS, it should look like this:

 gcc -Wall -pthread src/main.c -lm -lz -std=c99 -Wextra -o main 
+9
source

All Articles