"undefined reference to `zlibVersion'"

I'm currently trying to follow a sample code for curl, but I get this error:

In function `curl_version.part.0':
version.c:(.text+0x33): undefined reference to `zlibVersion'

The code I'm using is a direct copy/paste from this:

https://curl.haxx.se/libcurl/c/simple.html

While the makefile is a slightly altered version of this:

https://github.com/curl/curl/blob/master/docs/examples/Makefile.example

My version is almost identical, although with different paths and the non-curl libraries not included for this test:

1
2
3
4
5
6
7
8
9
10
11
TARGET = example
OBJS= simple.o
CC = gcc
CFLAGS = -c -g -I/home/Jatei/Email/curl-7.58.0/include/
LDFLAGS = -L/home/Jatei/Email/curl-7.58.0/lib/ -L/home/Jatei/Email/curl-7.58.0/lib/vtls
LIBS = -lcurl -pthread
$(TARGET) : $(OBJS)
	$(CC)  -o $(TARGET) $(OBJS) $(LDFLAGS) $(LIBS)

simple.o : simple.c
	$(CC) $(CFLAGS) $<


Does anyone know what this code means, why it occurred, and how I could fix it? Thank you!
Try adding -lz to LIBS
It worked, thanks! But for the sake of understanding, would you mind telling me what "z" is?
It's yet another library. In this case, the zlib compression library.
https://www.zlib.net/
Topic archived. No new replies allowed.