未定义的参考帮助 [英] undefined reference help

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

问题描述

我有:


#include< math.h>


int main(无效)

{

double i = 0.0;

double v = 0.0;


i = cos(v);


返回0;

}

i获取''未定义引用cos''。它发生在math.h中的任何

函数中。


怎么办?


顺便提一下使用rh 8.0 3.2-7 gcc 3.2版


请&谢谢!


---- ==通过Newsfeeds.Com发布 - 无限制 - 无限制 - 安全的Usenet新闻== ----
http://www.newsfeeds.com 世界排名第一的新闻组服务! 120,000多个新闻组

---- =东海岸和西海岸服务器农场 - 通过加密实现全隐私= ----

i have:

#include <math.h>

int main (void)
{
double i = 0.0;
double v = 0.0;

i = cos(v);

return 0;
}
i get ''undefined reference to cos''. it happens with any
function in math.h.

what to do?

btw using rh 8.0 3.2-7 gcc version 3.2

please & thanks!

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

推荐答案

none写道:
我有:

int main(void)
{
double i = 0.0;
double v = 0.0;

i = cos(v);

返回0;
}

i得到''未定义的引用'''。它发生在math.h中的任何函数。

怎么做?

btw使用rh 8.0 3.2-7 gcc版本3.2

请& amp ;谢谢!
i have:

#include <math.h>

int main (void)
{
double i = 0.0;
double v = 0.0;

i = cos(v);

return 0;
}
i get ''undefined reference to cos''. it happens with any function in math.h.

what to do?

btw using rh 8.0 3.2-7 gcc version 3.2

please & thanks!



[snip newsfeeds.com附属物]


[OT]

链接-lmath

[/ OT]


Joe


[snip newsfeeds.com appendage]

[OT]
link with -lmath
[/OT]

Joe


On Sun,2005年12月4日18:49:39 - 0500,在comp.lang.c中,没有< none @ all>

写道:
On Sun, 04 Dec 2005 18:49:39 -0500, in comp.lang.c , none <none@all>
wrote:

我得到''未定义引用cos''。它发生在math.h中的任何
函数。

i get ''undefined reference to cos''. it happens with any
function in math.h.




这是一个FAQ。请阅读。

-

Mark McIntyre

CLC FAQ< http://www.eskimo.com/~scs/C -faq / top.html>

CLC自述文件:< http://www.ungerhu.com/jxh/clc.welcome.txt>


---- ==通过Newsfeeds.Com发布 - 无限制 - 无限制 - 安全的Usenet新闻== ----
http://www.newsfeeds.com 世界排名第一的新闻组服务! 120,000多个新闻组

---- = East和West-Coast服务器场 - 通过加密实现全面隐私= ----



This is a FAQ. Please read it.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


Joe Estock < JE ***** @ NOSPAMnutextonline.com>写道:
Joe Estock <je*****@NOSPAMnutextonline.com> writes:
none写道:
我有:
#include< math.h>
int main(void)
{
双i = 0.0;
双v = 0.0;
i = cos(v);
返回0;
}
我得到''未定义参考cos''。它发生在
math.h中的任何函数。
i have:
#include <math.h>
int main (void)
{
double i = 0.0;
double v = 0.0;
i = cos(v);
return 0;
}
i get ''undefined reference to cos''. it happens with any function in
math.h.


[...] [OT]
链接-lmath
[/ OT]

[...] [OT]
link with -lmath
[/OT]




[OT]

-lm,不是-lmath。

C FAQ 14.3< http://www.eskimo .com / ~scs / C-faq / faq.html>

[/ OT]


-

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

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

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



[OT]
-lm, not -lmath.
C FAQ 14.3 <http://www.eskimo.com/~scs/C-faq/faq.html>
[/OT]

--
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.


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

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