在c++中使用递归方法的问题

Problem using recursive method in c++

本文关键字:递归方法 问题 c++      更新时间:2023-10-16

我有一个类,在像这样的.h中定义

#ifndef JLLABOUR_H
#define JLLABOUR_H
class JLLabour{
public:
JLLabour(int, int);
double* recursivefft(double*,int);
void FFT(int*);
~JLLabour();
private:
int width;
int height;
};
#endif // JLLABOUR_H

在我的.cpp中,我有递归函数的定义,问题是当我再次调用它时,在编译过程中,它不允许我继续,因为方法还没有定义。我不知道如何解决这个问题,请帮忙。

#include <JLLabour.h>
double* JLLabour::recursivefft(double* x,int asize){
//operations and declartions...
//...

  even = recursiveFFT(sum,m); //<-- the problem is here, in the recursion.
  odd = recursiveFFT(diff,m);
// more operations....
return result;
}
}

仅供参考,我正在Linux下编译,使用Qt,因为我正在开发一个图形应用程序。。。

C++区分大小写。您的方法称为recursivefft,而不是recursiveFFT