libmath

From Noah.org
Revision as of 16:17, 17 December 2012 by Root (Talk | contribs) (Created page with 'Category:Engineering == 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 the…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, 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