Christopher Henderson wrote:
I'm trying to teach myself C and I'm having trouble compiling my first
program.  This is following the C Tutorial at
<http://www.physics.drexel.edu/courses/Comp_Phys/General/C_basics/c_tutorial.html>.

My first program, a simple "Hello World", is as follows

#include < stdio.h>
Remove the space character between the "<" and stdio and try again.


void main()
{
printf("\nHello World\n");
}

I go to a console and type gcc hello.c as stated in the tutorial and get the following error spit out at me -

hello.c:1:20: stdio.h: No such file or directory
hello.c: In function `main':
hello.c:4: warning: return type of `main' is not `int'

well, I did a whereis on stdio.h and its in /usr/include - any ideas on the problem? I know this might be a bit off-topic, and btw I'm running RH 8.

Thnx folks,
~Christopher



Also, gcc hello.c will generate an executable called a.out. If you want
the executable to be called "hello" you should use gcc -o hello hello.c
instead.

To execute you would type ./hello and press the enter key.

Best Regards
Willem Brown

--
iServe (Pty) Ltd.
http://www.iserve.co.za/

Tel: +27 (0)11 258-7800
Fax: +27 (0)11 258-7888
Cell: +27 (0)83 271-0839



--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to