ubuntu 下gcc编译时math.h库不是默认指定,出现 gcc undefined reference to sqrt,ubuntu
出现这个错误须要在编译时指定链接那个库编译
gcc xx.c -lm -o xx.outgcc
-l是指定xx库,m就指math库。gc