分页: 1 / 1

关于math.h的问题

发表于 : 2006-03-15 19:07
lele635
编了个程序,并#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升到最高。请问这是怎么回事啊?

发表于 : 2006-03-15 20:31
smartyin
编译时要link数学库,所以要在你的编译命令里加参数-lm

发表于 : 2006-03-16 8:23
lele635
哦,已解决,谢谢!

good

发表于 : 2007-05-21 23:43
flyboy123321
我也解觉了,谢谢

Re: 关于math.h的问题

发表于 : 2009-10-01 13:23
gluon
谢谢,学习了