Re: no Hello World!!
- From: jt@xxxxxxxxxxx (Jens Thoms Toerring)
- Date: 19 Mar 2007 20:40:40 GMT
rwittenberg@xxxxxxxxxxxxxxx wrote:
I wrote a program using the Fedora Core 6 linux enviroment as follows:
#include <stdio.h>
int main()
You better make that
int main( void )
since your main() function doesn't take any arguments.
{
double number;
That line isn't needed at all, 'number' is never used anywhere.
printf("\nHello World");
return 0;
}
I compile this with "gcc -lm hello_world.c"
You should always put the libraries at end of the compile command.
And the program you will get out of this will be called 'a.out'.
If you want a program called 'hello_world' then you would need
gcc -o hello_world hello_world.c -lm
(but since you don't need antyhing from the math library you
can as well drop the '-lm' bit).
On running it on my debian woody system my program crashes with the
message "Floating Point Exception"
(gdb) run
Starting program: ~/hello_world.c
According to the command line above 'hello_world.c' is a C source
file, not a program. I don't really believe that this is the out-
put of gdb if you ask it to "run" a C source file. It will instead
tell you that you didn't specify an executable program
(no debugging symbols found)
No wonder since you didn't tell the compiler to include debugging
symbols into the executable - you would need the additional com-
piler flag '-g' for that.
Program received signal SIGFPE, Arithmetic exception.
0xb7fad5d1 in ?? ()
(gdb) bt
#0 0xb7fad5d1 in ?? ()
#1 0x00000000 in ?? ()
#2 0x00000000 in ?? ()
..............................
..............................
..............................
There are too many things that look as if your don't describe
what you have really done, so I can't come up with any reason-
able explanation. Did you try to run your 'a.out' program?
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@xxxxxxxxxxx
\__________________________ http://toerring.de
.
- Follow-Ups:
- Re: no Hello World!!
- From: rwittenberg
- Re: no Hello World!!
- References:
- no Hello World!!
- From: rwittenberg
- no Hello World!!
- Prev by Date: no Hello World!!
- Next by Date: Re: no Hello World!!
- Previous by thread: no Hello World!!
- Next by thread: Re: no Hello World!!
- Index(es):
Relevant Pages
|