[排错] linux gcc编译出现Undefined reference to 'sqrt' 类似错误

明明已经include了math.h,还是提示没有sqrt和floor等各种数学函数,解决办法是显式制定要链接libm数学库:

gcc -o target target.c -lm

-lm一定要放最后,否则编译失败

posted @ 2013-12-03 01:11  WarBean  阅读(406)  评论(0编辑  收藏  举报