help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Run Hello.c


From: Dave Seaman
Subject: Re: Run Hello.c
Date: Fri, 31 Oct 2008 11:48:20 +0000 (UTC)
User-agent: slrn/0.9.9 (Darwin)

On Wed, 29 Oct 2008 18:57:25 -0700, Linh Duong wrote:

> Hello There,

> I am new to C. I had look at the manual, configuration, and etc.

> Try to run the file on MAC OS.

> Downloaded gcc-testsuite-4.3.2

> gcc -o hello.c
> gcc -v hello.c

> It returns command not found. Can you please tell me what's wrong?

> #include <stdio.h>
> main ()
> {
> printf("Hello World\n");
> }


> Thanks,
> Linh

Your first step is to install Xcode.  This will be on the system discs
that came with your Mac.  Xcode includes gcc, but is not installed by
default.  Once you run the installer, you should find gcc in
/usr/bin/gcc, which is automatically in your PATH.

You can then run your program by using the commands

        gcc -o hello hello.c
        ./hello

Alternatively, you can launch Xcode and select "New Project" from the
File menu.  Then click on "Command Line Utility" in the sidebar of the
window that comes up, and select "Standard Tool" from the available
templates in the window.

Dave Seaman


reply via email to

[Prev in Thread] Current Thread [Next in Thread]