libmath
From Noah.org
Jump to navigationJump to search
Error: undefined reference to `sin' -- or any other function in math
I see this often in source I download. It makes me wonder if people test their stuff under Linux.
undefined reference to `sin' undefined reference to `cos' undefined reference to `tan' undefined reference to `sqrt' undefined reference to `pow' undefined reference to `sincosf'
When linking with gcc the -lm option must go at the end, after all the object files you are linking.
gcc -o my_math_program *.o -lm