[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 02473) problem with getipnodebyuname



Hi all

I have been working with IPv6 API, and I have a little problem with
getipnodebyname

when I try to compile this aplication it give me this error
leo@optimus:/home/leo/src$ gcc -Wall -O2 -o getipnodebyname
getipnodebyname.c
getipnodebyname.c: In function `main':
getipnodebyname.c:24: warning: implicit declaration of function
`getipnodebyname'
getipnodebyname.c:24: warning: assignment makes pointer from integer
without a cast
/tmp/cc8RVBvR.o(.text+0x50): In function `main':
: undefined reference to `getipnodebyname'
collect2: ld returned 1 exit status
--

The code resume is:

--
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>


void usage(char *name)
{
        fprintf(stderr, "usar %s <hostname> \n", name);
        exit(0);
}

int main(int argc, char *argv[])
{
        struct hostent *host;
        int *errnum = 0;
        char *nombre = argv[1];

        if (argc != 2) {
                usage(argv[0]);
        }

        host = getipnodebyname(nombre, AF_INET6, 0, errnum);
        printf("nombre %s\n", host->h_name);
	/* etc */

        return 0;
}
--


if somebody can bring me a little ligth about the problem.

TIA

+----------------------------------------------+  ,''`.
| Leonardo Saavedra Henriquez  |leo@xxxxxxxxxx | : :' :
| Est. Ing Civil en Informatica|U. del Bio-Bio | `. `'
+----------------------------------------------+   `-
[leo-> ~ $] cd pub && more beer