eclipse 对“round”c 语言的未定义引用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7236679/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Undefined reference to `round' c language
提问by Itzik984
I'm using those imports
我正在使用这些进口
#include <stdio.h>
#include <math.h>
and I'm getting undefined reference to `round'at this line:
我在这一行收到了对“round”的未定义引用:
double res = round(atof(nextVal));
nextValis a double value read from a file.
nextVal是从文件中读取的双精度值。
I'm using Eclipse INDIGO.
我正在使用 Eclipse INDIGO。
回答by Aif
In command line, you must specify -lm
option to gcc to link the math lib. You have to find how to do so in eclipse.
在命令行中,您必须-lm
为 gcc指定选项以链接数学库。你必须找到如何在 eclipse 中做到这一点。