代码: 全选
gcc -Wall fft.c -o fft.out
fft.c:78: warning: return type of ‘main’ is not ‘int’
fft.c: In function ‘main’:
fft.c:96: warning: format ‘%f’ expects type ‘double’, but argument 2 has type ‘complex’
/tmp/ccP5bnmV.o: In function `complex_exp':
fft.c:(.text+0xf): undefined reference to `exp'
fft.c:(.text+0x2c): undefined reference to `cos'
fft.c:(.text+0x54): undefined reference to `sin'
collect2: ld returned 1 exit status
加粗的三行是最关键的,在子函数里我调用了sin cos和exp三个函数,我在c文件最开始包含了math.h文件和stdio.h文件
有谁知道是怎么回事吗~~
附c文件:
代码: 全选
#include<stdio.h>
#include<math.h>
#define M_PI 3.14159265358979323846
…………
typedef struct {
float r,i;
}complex;
typedef struct {
double r,i;
}doublecomplex;
void complex_exp(complex *r,complex *z)
{
double expx;
expx = exp((double)z->r);
r->r = (float)expx * cos((double)z->i);
r->i = (float)expx * sin((double)z->i);
}
void fftc(complex *x,long *n,long *isign)
{
……………………
}
void main()
{
...............................
fftc(.........)
..................................
}