Error compiling a example code ("undefined reference to tcp_connect and tcp_close")

Pedro Pereira pedro.pereira at tut.fi
Mon May 10 16:08:25 CEST 2010


Hi all,

I am beginning with gnutls for the first time.
I have already installed every libraries and gnutls.
For now I am trying to compile a simple example that is available in  
the manual, "Simple Client Example with Anonymous Authentication":
http://www.gnu.org/software/gnutls/manual/html_node/Simple-client-example-with-anonymous-authentication.html#Simple-client-example-with-anonymous-authentication

I am just compiling adding the -lgnutls, and I receive some errors.  
the following output:

$ gcc -o foo foo.c -lgnutls
/tmp/ccnYRTg5.o: In function `main':
foo.c:(.text+0x73): undefined reference to `tcp_connect'
foo.c:(.text+0x22e): undefined reference to `tcp_close'
collect2: ld returned 1 exit status

It seems that the functions tcp_connect and tcp_close are not found  
inside the gnutls library..
Can someone help me to compile this example?

Kind Regards,
Pedro





More information about the Gnutls-help mailing list