Mail Archives: djgpp/1998/10/14/10:55:40
On Tue, 13 Oct 1998, Benjamin R. Saylor wrote:
> When I compile my program, I get the message "undefined reference to
> sinf." This doesn't happen with sin(), just sinf() (I haven't tried
> other *f()'s). I've tried adding -lm to both the start and the end of
> the command line as it says in the FAQ, but it doesn't work! What's
> going on?
The trivial one-liner below compiles fine (and runs) for me when I use
the following compilation command line:
gcc -Wall -D_USE_LIBM_MATH_H -O -g -o sft sft.c -lm
So please post more details, including the exact command line, the
version of the compiler, etc. Also try my program, just to be sure this
isn't specific to your program.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (int argc, char **argv)
{
return printf ("%f\n", sinf(atoi(argv[1])));
}
- Raw text -