[Courses] hello world program

Kathryn Hogg kjh at flyballdogs.com
Fri Feb 8 13:32:13 EST 2002


> Hi Everyone,
>
> Ok I am already confused. The book says to mkdir hello then cd hello
> open an editor so I opened vim and type the following
>
> #include <stdio.h>
> int main()
> {
>    printf ("Hello World\n");
>    return (0);
> }
>

This is probably a stupid question but did you do "vim hello.c"?

> that's it. then compile the code with cc -g -ohello hello.c
>
> I did this and it doesn't work.

Did the compile fail?  If so what error messages did you get?  Was cc not
found?  My system does not have a cc alias for gcc so I would do the
following:

gcc -g -o hello hello.c

and then run it as
./hello  # if you want to be specific about running hello from cwd
or
hello     # if you trust your path



--
Kathryn





More information about the Courses mailing list