From owner-freebsd-questions@FreeBSD.ORG Sat Feb 18 03:37:26 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 52CA116A420 for ; Sat, 18 Feb 2006 03:37:26 +0000 (GMT) (envelope-from mj001@rogers.com) Received: from smtp108.rog.mail.re2.yahoo.com (smtp108.rog.mail.re2.yahoo.com [68.142.225.206]) by mx1.FreeBSD.org (Postfix) with SMTP id A0F9943D48 for ; Sat, 18 Feb 2006 03:37:25 +0000 (GMT) (envelope-from mj001@rogers.com) Received: (qmail 81156 invoked from network); 18 Feb 2006 03:37:24 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=rogers.com; h=Received:Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date:Message-Id:Mime-Version:X-Mailer:Content-Transfer-Encoding; b=m5kJVWLJ2xX+vg7FBEaWA+XsZkYMPwS38tPPbEvTH/hZvWN/AsDe7A4hMKYNBLjrhpxWO5kXYZeFZTwB0iGsVIx+kdBbX8TuyNjcMcpi5GjfDAfM1VohSOT1xW/9Q9gU7HaOnIrEJ2HIFqb3ic61LOIgmjDgiMEJNNckbiZFaBk= ; Received: from unknown (HELO chaucer.jeays.ca) (mj001@rogers.com@72.139.51.96 with plain) by smtp108.rog.mail.re2.yahoo.com with SMTP; 18 Feb 2006 03:37:24 -0000 From: Mike Jeays To: freebsd@voidmain.net In-Reply-To: <43F68C7D.9010403@voidmain.net> References: <43F68C7D.9010403@voidmain.net> Content-Type: text/plain Date: Fri, 17 Feb 2006 22:37:23 -0500 Message-Id: <1140233843.982.21.camel@chaucer.jeays.ca> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: getline function X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Feb 2006 03:37:26 -0000 On Fri, 2006-02-17 at 21:54 -0500, Tom Grove wrote: > Is there anyone who can compile a program using the getline() function? > Here is a really simple program to recreate the following error: > > ##Error## > /var/tmp//ccvYIi4C.o(.text+0x26): In function `main': > : undefined reference to `getline' > ##Error## > > ##Source File## > #include > > int main() { > char line[10]; > > getline(&line, 10); > printf("%s", line); > > return 0; > } > ## Source File## > > -Tom > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" I got a bit further by installing the port for getline (/usr/ports/devel/libgetline), and changed the code slightly to provide a single parameter. (Look at man getline) #include #include int main() { char line[10]="test"; getline(line); printf("%s", line); return 0; } chaucer 29 ~/c $ cc -o getline -I/usr/local/include -L/usr/local/lib getline.c -lgetline chaucer 30 ~/c $ getline testnow testchaucer 31 ~/c $ -- Mike Jeays http://ca.geocities.com/mike.jeays@rogers.com