This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Math library

Hi..
I need to use the cos and sin functions.
what are the libraries I need to add ?
is it only <math.h> ? if yes, i tried that and i got error message:

/cygdrive/h/Ex3/FFT/FFT.c(45): error: undefined reference to 'cos'

Thankx

Parents
  • The error you got was "undefined reference". That's a linker error message, telling you that it found no implementation of cos() in any of the places you told it to look. I.e. the problem is not that the code calls cos() in some strange way --- it's that it calls it at all, and that the linker can't find the actual function.

    Time to open the documentation and find the library reference manual, to see where the implementation of cos() is supposed to be.

Reply
  • The error you got was "undefined reference". That's a linker error message, telling you that it found no implementation of cos() in any of the places you told it to look. I.e. the problem is not that the code calls cos() in some strange way --- it's that it calls it at all, and that the linker can't find the actual function.

    Time to open the documentation and find the library reference manual, to see where the implementation of cos() is supposed to be.

Children