>
> However when I try to compile this I get something unexpected
> (an error):
>
> mhe@bilbo:/mnt/pcm > gcc -Wall test.c
>
> test.c: In function `main':
> test.c:18: warning: implicit declaration of function `atol'

man atol specify that you should include stdlib.h to use this function.
so add at the begining of the source code:
#include <stdlib.h>


> test.c:28: warning: use of `l' length character with `f' type
> character

this is a problem with your "printf" line. correct it or live with it.

> /tmp/cca002611.o: In function `main':
> /tmp/cca002611.o(.text+0x9a): undefined reference to `sqrt'

this is the linker complaining about the symbol sqrt not found.
you should tell the linker that sqrt is defined in libm.so
use this to compile and link:
gcc -Wall test.c -lm

by the way, this command will ive you a binary called a.out
do NOT rename it "test" since test is a real unix command
(this mistake is a wellknow one, trying to execute test and nothing   
expected happening :-)

Reply via email to