Re: cos() in math.h ?
* Christophe TROESTLER <firstname.lastname@example.org>
> 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
> /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
gcc program.c -o program -lm