关于math.h的问题

软件和网站开发以及相关技术探讨
回复
lele635
帖子: 3
注册时间: 2005-10-14 13:28

关于math.h的问题

#1

帖子 lele635 » 2006-03-15 19:07

编了个程序,并#include <math.h>。但是gcc filename时却出现如下信息:
Complex.cc:(.text+0x10f): undefined reference to `sqrt'
Complex.cc:(.text+0x264): undefined reference to `sin'
Complex.cc:(.text+0x2a9): undefined reference to `cos'
Complex.cc:(.text+0x910): undefined reference to `log'
Complex.cc:(.text+0x933): undefined reference to `exp'
已用sudo apt-get install gcc升到最高。请问这是怎么回事啊?
smartyin
帖子: 99
注册时间: 2005-12-20 17:06

#2

帖子 smartyin » 2006-03-15 20:31

编译时要link数学库,所以要在你的编译命令里加参数-lm
lele635
帖子: 3
注册时间: 2005-10-14 13:28

#3

帖子 lele635 » 2006-03-16 8:23

哦,已解决,谢谢!
flyboy123321
帖子: 3
注册时间: 2007-05-20 0:00

good

#4

帖子 flyboy123321 » 2007-05-21 23:43

我也解觉了,谢谢
gluon
帖子: 55
注册时间: 2007-07-17 17:53

Re: 关于math.h的问题

#5

帖子 gluon » 2009-10-01 13:23

谢谢,学习了
回复