C语言中的“Undefined reference to `round'”是什么意思?

4
我正在使用这些导入。
#include <stdio.h>
#include <math.h>

我在这一行遇到了undefined reference to `round'的问题:

double res = round(atof(nextVal));

nextVal 是从文件中读取的双精度浮点数。

我正在使用Eclipse INDIGO。

1个回答

15
在命令行中,您必须指定-lm选项来链接数学库。您需要找到如何在eclipse中执行此操作。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接