【问题标题】:Problem using recursive method in c++ [closed]在c ++中使用递归方法的问题[关闭]
【发布时间】:2011-05-24 14:13:21
【问题描述】:

我有一个类,像这样在 .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,因为我正在开发图形应用程序...

【问题讨论】:

  • sumdiffevenoddm的类型有哪些?
  • 您认为的问题可能不是。请发布您遇到的错误。

标签: c++ class methods recursion


【解决方案1】:

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

【讨论】:

  • 使用 IDE 而不是一些文本编辑器可能会阻止这种情况。
  • 天哪,我知道这一点,但仍然没有注意到。就是这样,我很抱歉,真是个愚蠢的错误。
  • @Space_C0wb0y 我认识的编辑器都有自动补全功能。如果使用它,那么就不会发生这种错误,如果不是,那么大概 IDE 也无济于事。 (必须可以有两个名称,只是大小写不同。)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-01-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-14
  • 2020-05-30
相关资源
最近更新 更多