Unresolved external symbol vftable c++

mfcvisual c++visual-studio-2008vtk

I am using visual studio 2008 in my MFC + vtk project. There I am getting a linking error as below:

vtkPBFEAView.obj : warning LNK4217: locally defined symbol ?DrawDC@vtkMFCWindow@@QAEXPAVCDC@@@Z (public: void __thiscall vtkMFCWindow::DrawDC(class CDC *)) imported in function "protected: virtual void __thiscall CvtkPBFEAView::OnDraw(class CDC *)" (?OnDraw@CvtkPBFEAView@@MAEXPAVCDC@@@Z)

1>vtkMDIView.obj : warning LNK4049: locally defined symbol ?DrawDC@vtkMFCWindow@@QAEXPAVCDC@@@Z (public: void __thiscall vtkMFCWindow::DrawDC(class CDC *)) imported
1>vtkPBFEAView.obj : warning LNK4217: locally defined symbol ??0vtkMFCWindow@@QAE@PAVCWnd@@@Z (public: __thiscall vtkMFCWindow::vtkMFCWindow(class CWnd *)) imported in function "public: void __thiscall vtkPBFEAViewImpl::initialize(class CWnd *)" (?initialize@vtkPBFEAViewImpl@@QAEXPAVCWnd@@@Z)

1>vtkMDIView.obj : warning LNK4049: locally defined symbol ??0vtkMFCWindow@@QAE@PAVCWnd@@@Z (public: __thiscall vtkMFCWindow::vtkMFCWindow(class CWnd *)) imported
1>vtkPBFEAView.obj : warning LNK4217: locally defined symbol ??1vtkMFCWindow@@UAE@XZ (public: virtual __thiscall vtkMFCWindow::~vtkMFCWindow(void)) imported in function "public: virtual void * __thiscall vtkMFCWindow::`scalar deleting destructor'(unsigned int)" (??_GvtkMFCWindow@@UAEPAXI@Z)

1>vtkMDIView.obj : warning LNK4217: locally defined symbol ??1vtkMFCWindow@@UAE@XZ (public: virtual __thiscall vtkMFCWindow::~vtkMFCWindow(void)) imported in function "public: void __thiscall vtkMDIViewImpl::adjust_contours(int,double,double)" (?adjust_contours@vtkMDIViewImpl@@QAEXHNN@Z)

1>vtkMFCWindow.obj : error LNK2019: unresolved external symbol "_declspec(dllimport) const vtkMFCWindow::`vftable'" (_imp_??_7vtkMFCWindow@@6B@) referenced in function "public: __thiscall vtkMFCWindow::vtkMFCWindow(class CWnd *)" (??0vtkMFCWindow@@QAE@PAVCWnd@@@Z)

Can anyone explain me the reason for this error?

Thanks in advance.

Best Answer

Finally I found the answer for the problem. It was that vtkMFCWindow was configured with /MD option and my main project was configured with /MTd option. And therefore I got the error. Once I removed the __declspec( dllexport ) lines and it worked well. Thanks for the help.

Related Topic