Question

I am try to compile the simple client/server code in GnuTLS, but a few errors of undefined reference.

$ gcc -o client client.o tcp.o `pkg-config gnutls --libs`
client.o: In function `main':
client.c:(.text+0x159): undefined reference to `gnutls_handshake_set_timeout'
client.o: In function `_verify_certificate_callback':
client.c:(.text+0x36a): undefined reference to `gnutls_certificate_verify_peers3'
client.c:(.text+0x3b1): undefined reference to `gnutls_certificate_verification_status_print'
collect2: ld returned 1 exit status

The result is the same if using "-lgnutls" option. Thanks a lot for the tip.

BTW, the sample code is located here (http://gnutls.org/manual/html_node/Client-examples.html).

Was it helpful?

Solution

TFM has this to say about what to do if you want to compile a source file including the gnutls/gnutls.h header file:

gcc -o foo foo.c `pkg-config gnutls --cflags --libs`
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top