From owner-freebsd-questions Thu Jul 8 12: 8:38 1999 Delivered-To: freebsd-questions@freebsd.org Received: from sand2.global.net.uk (sand2.global.net.uk [195.147.246.100]) by hub.freebsd.org (Postfix) with ESMTP id 550B315552 for ; Thu, 8 Jul 1999 12:08:26 -0700 (PDT) (envelope-from marko@globalnet.co.uk) Received: from pecs12a06.client.global.net.uk ([195.147.220.237] helo=marder-1.) by sand2.global.net.uk with esmtp (Exim 2.05 #1) id 112JWx-0003s0-00; Thu, 8 Jul 1999 20:08:25 +0100 Received: (from marko@localhost) by marder-1. (8.9.2/8.8.8) id UAA00446; Thu, 8 Jul 1999 20:03:16 +0100 (BST) (envelope-from marko) Date: Thu, 8 Jul 1999 20:03:15 +0100 From: Mark Ovens To: Rezamys Cc: freebsd-questions@freebsd.org Subject: Re: newbie: how to compile & run C program in 3.2Release? Message-ID: <19990708200315.B257@marder-1> References: <3782BC71.C501C08A@tm.net.my> <19990707033149.B254@marder-1> <37841BF3.3BB6F13A@tm.net.my> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: <37841BF3.3BB6F13A@tm.net.my>; from Rezamys on Thu, Jul 08, 1999 at 11:33:07AM +0800 Organization: Total lack of Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Jul 08, 1999 at 11:33:07AM +0800, Rezamys wrote: > Hi Mark, > Okay, tried it last nite. It was fine. Thanks! > I did this (very simple program...): > > #include > int main(void) { > printf("hello, world!\n"); > return 0; > } > > Then I typed: bash$ cc hello.c > bash$ ls > bash$ a.out hello.c > > So rename the a.out file: cc hello.c -o hello > Then run it: ./hello > Ouput: "hello, world!" > Excellent :) > > I haven't tried using gcc before. Will this GNU C Compiler work? > cheers! > I'm not sure what you're asking here. cc *is* a GNU compiler. If you mean will gcc work, then yes, but you're already using it. The default version with FreeBSD is 2.7.2.1, this is the only one verified to build kernels. You can install gcc-2.8.1 (which you use as gcc -o hello hello.c). This won't overwrite the default so you will have 2 versions. I doubt, however, that you will need anymore than the default. OK, you done "Hello, World". Now get yourself a copy of Kernighan & Ritchie (2nd edition), and carry on ;-). > > Mark Ovens wrote: > > > On Wed, Jul 07, 1999 at 10:33:21AM +0800, Rezamys wrote: > > > Hi all, > > > This surely sound silly but at least i'm being honest to myself... > > > Anyways, i created a simple program e.g "hello world" in the ee editor > > > and did a complilation like this: > > > > > > bash$ cc hello.c > > > > > > It gave no error. Fine. When i type: > > > > > > bash$ hello.c > > > > > > The output tells me that "hello.c command not found"... > > > I heard from a friend that we have to see the ouput (on the screen) > > > "hello world" in your editor and not at your prompt. > > > > > > > The output from ``cc hello.c'', the program, will be called ``a.out'' > > and will be in your current directory. Try typing ``./a.out''. You > > need the ``./'' if the current dir is not in your path. > > > > If you want your program to be called something other than a.out, > > use the ``-o'' option when you compile: > > > > cc -o hello hello.c > > > > This will name the program ``hello'' > > > > HTH > > > > > In DOS i could see the output displayed on the screen... but this...gee > > > i don't know... > > > > > > Please help. > > > > > > > > > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > > with "unsubscribe freebsd-questions" in the body of the message > > > > > > > -- > > FreeBSD - The Power To Serve http://www.freebsd.org > > My Webpage http://www.users.globalnet.co.uk/~markov > > _______________________________________________________________ > > Mark Ovens, CNC Apps Engineer, Radan Computational Ltd. Bath UK > > CAD/CAM solutions for Sheetmetal Working Industry > > mailto:markov@globalnet.co.uk http://www.radan.com > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-questions" in the body of the message > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > -- FreeBSD - The Power To Serve http://www.freebsd.org My Webpage http://www.users.globalnet.co.uk/~markov _______________________________________________________________ Mark Ovens, CNC Apps Engineer, Radan Computational Ltd. Bath UK CAD/CAM solutions for Sheetmetal Working Industry mailto:markov@globalnet.co.uk http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message