* Christophe TROESTLER <[EMAIL PROTECTED]>
>
> Hi all,
> 
> According to the man page, if I want to use `cos' in a program, I
> simply need to include `math.h'.  However, when I compile, I got the
> error:
> 
>       /tmp/cc9WOsLC.o(.text+0x16): undefined reference to `cos'
>       collect2: ld returned 1 exit status
> 
> I got the necessary packages to compile (e.g., libc6-dev).  Any idea
> what is the cause ?

You need to link with the math library; add -lm to your compiler command
line, ie.

gcc program.c -o program -lm

-- 
Kjetil

Reply via email to