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

Zlo*_*niy -2 c++ methods recursion class

我有一个类,在.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
Run Code Online (Sandbox Code Playgroud)

在我的.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;
}
}
Run Code Online (Sandbox Code Playgroud)

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

Cat*_*lus 9

C++区分大小写.你的方法recursivefft不是recursiveFFT.

  • 使用IDE而不是某些文本编辑器可能会阻止这种情况. (2认同)