对 log10 函数的未定义引用 [英] Undefined reference to log10 function

查看:56
本文介绍了对 log10 函数的未定义引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Eclipse Kepler 构建,并且包含了 math.h.但是,我收到一个错误

I am building using Eclipse Kepler, and have included math.h. However, I am getting an error

'未定义对 log10 的引用'.

'undefined reference to log10'.

还没有解析 uint8_tunit32_t 类型.我已经包括了 stdint.hinttypes.h,只是为了确定,但没有成功.有人可以帮忙吗?

Also types uint8_t and unit32_t are not being resolved. I have included both stdint.h and inttypes.h, just to be sure, but wasn't successful. Can someone kindly help?

推荐答案

'未定义对 log10 的引用'.

因为头文件只提供了函数的前向声明.实际的函数定义存在于 ("math") 库中.您需要使用 -lm 链接数学库.

Because, the header file only provides the forward declaration of the function. The actual function definition is present in the ("math") library. You need to link with the math library using -lm.

参考:手册页 log10

此外,AFAIK、uint_t 存在于 中.请检查您的代码中是否存在头文件本身和/或任何拼写错误(如您的示例中的 unit32_t).

Also, AFAIK, uint<N>_t are present in <stdint.h>. Please check for the existence for the header file itself and/or any typos (like unit32_t in your example) in your code.

这篇关于对 log10 函数的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆