From owner-freebsd-questions@FreeBSD.ORG Sat Sep 13 14:13:13 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 21FE416A4BF for ; Sat, 13 Sep 2003 14:13:13 -0700 (PDT) Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [204.127.198.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5DE3243FB1 for ; Sat, 13 Sep 2003 14:13:12 -0700 (PDT) (envelope-from freebsd-questions-local@be-well.no-ip.com) Received: from be-well.ilk.org (be-well.no-ip.com[66.30.200.37]) by comcast.net (rwcrmhc11) with ESMTP id <2003091321131101300kf05se>; Sat, 13 Sep 2003 21:13:11 +0000 Received: from be-well.ilk.org (lowellg.ne.client2.attbi.com [66.30.200.37] (may be forged)) by be-well.ilk.org (8.12.9/8.12.9) with ESMTP id h8DLDACo073288; Sat, 13 Sep 2003 17:13:10 -0400 (EDT) (envelope-from freebsd-questions-local@be-well.no-ip.com) Received: (from lowell@localhost) by be-well.ilk.org (8.12.9/8.12.6/Submit) id h8DLDAS9073285; Sat, 13 Sep 2003 17:13:10 -0400 (EDT) X-Authentication-Warning: be-well.ilk.org: lowell set sender to freebsd-questions-local@be-well.ilk.org using -f Sender: lowell@be-well.no-ip.com To: Claudiu Bichir References: <20030913175229.68285.qmail@web41312.mail.yahoo.com> From: Lowell Gilbert Date: 13 Sep 2003 17:13:10 -0400 In-Reply-To: <20030913175229.68285.qmail@web41312.mail.yahoo.com> Message-ID: <44he3gcryx.fsf@be-well.ilk.org> Lines: 27 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii cc: freebsd-questions@freebsd.org Subject: Re: Compile error X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Sep 2003 21:13:13 -0000 Claudiu Bichir writes: > Hy guys ! I'm triyng to compile this simple prog. in FreeBSD 5.0: > #include > #include > > 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).