未定义的对楼层的引用() [英] undefined reference to floor()

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

问题描述




我正在编译一个包含math.h的C源文件,但是我收到一条错误

消息,指出对楼层的未定义引用( )。


如果这个函数在math.h中,怎么会发生这种情况,是不是在

标准库中?我需要明确链接吗?


谢谢,


Michael

Hi,

I am compiling a C source file that includes math.h but I get an error
message that states undefined reference to floor().

How could that happen if this function is in math.h, isn''t in the
standard library? Do I need to link it explicitly?

Thanks,

Michael

推荐答案



Michael McGarry写道:

Michael McGarry wrote:


我正在编译包含数学的C源文件.h但是我收到一条错误消息,指出对floor()的未定义引用。

如果这个函数在math.h中,怎么会发生,不在
标准库?我是否需要明确地链接它?
Hi,

I am compiling a C source file that includes math.h but I get an error
message that states undefined reference to floor().

How could that happen if this function is in math.h, isn''t in the
standard library? Do I need to link it explicitly?




在Solaris和Linux上,数学函数位于不同的库中



编译器不会链接,除非你告诉它。这叫做

libm.so(-lm)。

-

Ioan - Ciprian Tandau

tandau _at_ freeshell _dot_ org(希望现在还不算太晚)

(......它仍然有效......)



On Solaris and Linux the math functions are in a different library that
the
compiler does not link against unless you tell it to. It''s called
libm.so (-lm).
--
Ioan - Ciprian Tandau
tandau _at_ freeshell _dot_ org (hope it''s not too late)
(... and that it still works...)

< br>

" Michael McGarry" < MI ************* @ gmail.com>写道:
"Michael McGarry" <mi*************@gmail.com> writes:
我正在编译包含math.h的C源文件,但是我收到一条错误消息,指出未定义对floor()的引用。

如何如果这个函数在math.h中,可能会发生这种情况,是不是在
标准库中?我是否需要明确链接?
I am compiling a C source file that includes math.h but I get an error
message that states undefined reference to floor().

How could that happen if this function is in math.h, isn''t in the
standard library? Do I need to link it explicitly?




< http://www.c-faq.com/fp/libm.html>


-

Keith Thompson(The_Other_Keith) ks***@mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。



<http://www.c-faq.com/fp/libm.html>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


工作(即-lm)。谢谢!!!

That worked (i.e., -lm). Thanks!!!


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

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