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

ERROR LNK2019 ( Unresolved external symbol) IN VS2008 WITH ITK AND FFTW

本文关键字:VS2008 ITK FFTW 符号 外部 LNK2019 错误      更新时间:2023-10-16

我正在执行一个使用ITK处理医学图像的项目。经过大量的工作,没有进一步的编译错误,但在链接过程中,我有以下信息:

1>------生成开始:项目:prueba_r01,配置:Debug Win32 ------1在链接……1>创建库C:Documents and SettingsGTTSMis documenttos Visual Studio 2008Projectsprueba_r01Debugprueba_r01。lib和object C:Documents and SettingsGTTSMis documenttos Visual Studio 2008Projectsprueba_r01Debugprueba_r01.exp

1祝辞prueba_r01。obj: error LNK2019: extern symbol "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 SettingsGTTSMis documenttos Visual Studio 2008Projectsprueba_r01Debugprueba_r01.exe: fatal error LNK1120: 1 externos sin resolver

1>prueba_r01 - 2错误,0警告========== Generar: 0纠正,1错误,0真实化,0省掉 ==========

方法multiply_matrix_2D在私有槽" filter() "(翻译为filter)内调用时产生错误文件的头是:

#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;
 }

任何帮助将是非常好的!!我现在完全迷路了……谢谢!谢谢!安东尼奥

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

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

您在实现中忘记了类名(prueba_r01::),因此它没有找到函数体