Date: 13 Sep 2003 17:13:10 -0400 From: Lowell Gilbert <freebsd-questions-local@be-well.no-ip.com> To: Claudiu Bichir <claudiubichir@yahoo.com> Cc: freebsd-questions@freebsd.org Subject: Re: Compile error Message-ID: <44he3gcryx.fsf@be-well.ilk.org> In-Reply-To: <20030913175229.68285.qmail@web41312.mail.yahoo.com> References: <20030913175229.68285.qmail@web41312.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Claudiu Bichir <claudiubichir@yahoo.com> writes:
> Hy guys ! I'm triyng to compile this simple prog. in FreeBSD 5.0:
> #include <stdio.h>
> #include <netdb.h>
>
> int main()
> {
> char h[80];
> struct hostent *x;
>
> printf("Host:");scanf("%s",h);
> x=gethostbyname(h);
> printf("%s\n", x->h_addr_list[0][0]);
> return 0;
> }
>
> but it gives me the fallowing error
> /var/tmp//ccDxQUWw.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
> Does anybody know why ?
You're compiling it wrong. A simple "cc program.c" builds for me.
Note, however, that h_addr_list isn't a set of strings; it's a set of
actual addresses, in network byte order. You'll need to iterate
through those bytes, printing each one separately (the h_length field
tells you how long they are).
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44he3gcryx.fsf>
