这个错误一般出现在Linux系统上,原因是程序中使用了数学库函数sin(),但在链接时却没有找到对应的库文件。
解决方法有两种:
1.在编译时加上-lm选项,指定链接数学库文件。
例如:
gcc -o test test.c -lm
2.在程序头部包含math.h头文件,这样就可以省略-lm选项了。
例如:
#include
int main() { double result = sin(1.0); return 0; }
上一篇:编译时出现'cannotfind-lgsl,cannotfind-lgslcblas”错误提示。
下一篇:编译时出现'classheader:error:expectedunqualified-idbefore'char'”错误提示。