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

Simon Josefsson simon at josefsson.org
Mon May 10 17:50:32 CEST 2010


Pedro Pereira <pedro.pereira at tut.fi> writes:

> 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?

Read this section:

http://www.gnu.org/software/gnutls/manual/html_node/Helper-function-for-TCP-connections.html

/Simon




More information about the Gnutls-help mailing list