From owner-freebsd-questions Tue Jul 6 19:31:33 1999 Delivered-To: freebsd-questions@freebsd.org Received: from WEBBSD1.turnaround.com.au (webbsd1.turnaround.com.au [203.39.138.49]) by hub.freebsd.org (Postfix) with ESMTP id 4A81215009 for ; Tue, 6 Jul 1999 19:31:26 -0700 (PDT) (envelope-from A_Johns@TurnAround.com.au) Received: from tasajohns (dhcp64.turnaround.com.au [192.168.1.64]) by WEBBSD1.turnaround.com.au (8.8.7/8.8.7) with SMTP id MAA15854; Wed, 7 Jul 1999 12:49:35 +1000 (EST) (envelope-from A_Johns@TurnAround.com.au) From: "Andrew Johns" To: "Rezamys" , Subject: RE: newbie: how to compile & run C program in 3.2Release? Date: Wed, 7 Jul 1999 12:30:14 +1000 Message-ID: <000501bec820$a4c0f3d0$4001a8c0@tasajohns.turnaround.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 In-Reply-To: <3782BC71.C501C08A@tm.net.my> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG See comments below... > -----Original Message----- > From: owner-freebsd-questions@FreeBSD.ORG > [mailto:owner-freebsd-questions@FreeBSD.ORG]On Behalf Of Rezamys > Sent: Wednesday, 7 July 1999 12:33 > To: freebsd-questions@FreeBSD.ORG > Subject: newbie: how to compile & run C program in 3.2Release? > > > 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. hello.c is the c program text file and is not executable. cc will create an executable by default with the name a.out (I don't know if the new elf system names it something different - check by doing an ls after the cc command). To run the program, you need to add a ./ in front of the file name (ie: ./a.out) as the current directory is _not_ searched for executables (to prevent accidental running of trojan programs). To get cc to rename the file, use: cc hello.c -o hello and it will create an executable called 'hello' which you could then run with ./hello See the man page for cc for other compiler options, and check the -o to make sure that I remembered it correctly. Cheers AJ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message