错误LNK2019(未解析的外部符号)IN VS2008与ITK和FFTW

时间:2011-07-08 11:08:51

标签: c++ visual-studio-2008 visual-c++ fftw itk

我正在与ITK合作处理医学影像。经过大量工作后,没有进一步的编译错误,但在链接过程中,我有以下信息:

  

1> ------生成开始:proyect:prueba_r01,配置:调试Win32 ------   1个GT;链接...   1>创建库C:\ Documents and Settings \ GTTS \ Mis documentos \ Visual Studio 2008 \ Projects \ prueba_r01 \ Debug \ prueba_r01.lib和对象C:\ Documents and Settings \ GTTS \ Mis documentos \ Visual Studio 2008 \ Projects \ prueba_r01 \调试\ prueba_r01.exp

     

1> prueba_r01.obj:错误LNK2019:extern符号“public:double(* __thiscall prueba_r01 :: multiply_matrix_2D(double()[2],double()[2],int,int ))[2]“(?multiply_matrix_2D @ prueba_r01 @@ QAEPAY01NPAY01N0HH @ Z)未解决,在函数”private:void __thiscall prueba_r01 :: filtro(void)“中引用(?filtro @ prueba_r01 @@ AAEXXZ)

     

1> C:\ Documents and Settings \ GTTS \ Mis documentos \ Visual Studio 2008 \ Projects \ prueba_r01 \ Debug \ prueba_r01.exe:致命错误LNK1120:1 externos sin resolver

     

1> prueba_r01 - 2个错误,0个警告   ========== Generar:0纠正,1个incorrects,0个实现,0个省略==========

方法multiply_matrix_2D在私有槽“filtro()”内调用时产生错误(翻译为过滤器) 该文件的标题是:

#include <QtGui/QMainWindow>
#include "ui_prueba_r01.h"
#include "vicdef.h"
#include "itkImage.h"
#include "math.h"
#include <complex>
#include "fftw3.h"
using namespace std;

#define PI 3.14159265

class prueba_r01 : public QMainWindow
{
Q_OBJECT

public:
typedef double PixelType;
typedef itk::Image < PixelType, 2> ImageType;
    ImageType::Pointer imagen;

double** H;

prueba_r01(QWidget *parent = 0, Qt::WFlags flags = 0);
~prueba_r01();

void matrix2D_H(int ancho, int alto, double eta, double sigma);
fftw_complex* multiply_matrix_2D(fftw_complex* out, fftw_complex* H,int a, int b);

private slots:
void openRGB();
void filtro();


private:
Ui::prueba_r01Class ui;
};

#endif // PRUEBA_R01_H

问题所在的主要部分位于.cpp文件中,并显示在此处:

fftw_complex* res ;
res = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*a*b);
fftw_complex* H_casted= reinterpret_cast<fftw_complex*> (&H);
res = multiply_matrix_2D(out,H_casted, a, b);

这里完成了向* fftw_complex投射**双指针的过程,因为我想将频域(H(w))中的滤波器与图像的fft变换结果相乘,这就是原因。重要的是要注意fftw_complex是double [2],真实部分的第一行,虚构的第二行 有问题的方法如下所示:

 fftw_complex* multiply_matrix_2D(fftw_complex* out, fftw_complex* H, int a ,int b){
/* The matrix out[axb] or [n0x(n1/2)+1] is the image after the FFT , and the           out_H[axb] is the filter in the frequency domain,
both are multiplied POINT TO POINT, it has to be called  twice, one for the imaginary part and another for the normal part
*/
 fftw_complex *res;
 res = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*a*b);
 for (int i0 = 0; i0<a ; i0++){
for (int i1 = 0; i1<b ; i1++){
 res[i1+a*i0][0] = out[i1+a*i0][0]*(H[0][0]+H[0][1]); // real part          
 res[i1+a*i0][1] = out[i1+a*i0][1]*(H[0][0]+H[0][1]); // imaginary part
    }
 }
 return res;
 }

任何帮助都会非常好!!我现在很迷茫...... 谢谢!格拉西亚斯! 安东尼奥

1 个答案:

答案 0 :(得分:2)

将cpp文件中的函数头更改为:

fftw_complex* prueba_r01::multiply_matrix_2D(fftw_complex* out, fftw_complex* H, int a, int b) 

你忘了实现中的类名(prueba_r01::),因此找不到函数体