[vtkusers] Linking to VTK static libraries on Windows

Gib Bogle g.bogle at auckland.ac.nz
Thu Oct 14 19:32:09 EDT 2010


I have built VTK libraries statically, with MSVS 2005.  I'm having trouble 
linking the libraries to my Qt application.  I have included in the build all 
the VTK libraries that seem to be possibly needed (using Dependency Walker), but 
still I get these errors:

1>myvtk.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
public: static class vtkBMPWriter * __cdecl vtkBMPWriter::New(void)" 
(__imp_?New at vtkBMPWriter@@SAPAV1 at XZ) referenced in function "public: void 
__thiscall MyVTK::saveSnapshot(class QString,class QString)" 
(?saveSnapshot at MyVTK@@QAEXVQString@@0 at Z)
1>myvtk.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
public: static class vtkTIFFWriter * __cdecl vtkTIFFWriter::New(void)" 
(__imp_?New at vtkTIFFWriter@@SAPAV1 at XZ) referenced in function "public: void 
__thiscall MyVTK::saveSnapshot(class QString,class QString)" 
(?saveSnapshot at MyVTK@@QAEXVQString@@0 at Z)
1>myvtk.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
public: static class vtkJPEGWriter * __cdecl vtkJPEGWriter::New(void)" 
(__imp_?New at vtkJPEGWriter@@SAPAV1 at XZ) referenced in function "public: void 
__thiscall MyVTK::saveSnapshot(class QString,class QString)" 
(?saveSnapshot at MyVTK@@QAEXVQString@@0 at Z)
1>myvtk.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
public: static class vtkPNGWriter * __cdecl vtkPNGWriter::New(void)" 
(__imp_?New at vtkPNGWriter@@SAPAV1 at XZ) referenced in function "public: void 
__thiscall MyVTK::saveSnapshot(class QString,class QString)" 
(?saveSnapshot at MyVTK@@QAEXVQString@@0 at Z)
1>myvtk.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
public: void __thiscall vtkWindowToImageFilter::SetInput(class vtkWindow *)" 
(__imp_?SetInput at vtkWindowToImageFilter@@QAEXPAVvtkWindow@@@Z) referenced in 
function "public: void __thiscall MyVTK::saveSnapshot(class QString,class 
QString)" (?saveSnapshot at MyVTK@@QAEXVQString@@0 at Z)
1>myvtk.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
public: static class vtkTextSource * __cdecl vtkTextSource::New(void)" 
(__imp_?New at vtkTextSource@@SAPAV1 at XZ) referenced in function "public: static 
class vtkSmartPointer<class vtkTextSource> __cdecl vtkSmartPointer<class 
vtkTextSource>::New(void)" (?New@?$vtkSmartPointer at VvtkTextSource@@@@SA?AV1 at XZ)
1>myvtk.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
public: static class vtkWindowToImageFilter * __cdecl 
vtkWindowToImageFilter::New(void)" 
(__imp_?New at vtkWindowToImageFilter@@SAPAV1 at XZ) referenced in function "public: 
__thiscall MyVTK::MyVTK(class QWidget *)" (??0MyVTK@@QAE at PAVQWidget@@@Z)
1>myvtk.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
public: int __thiscall vtkCellArray::InsertNextCell(class vtkCell *)" 
(__imp_?InsertNextCell at vtkCellArray@@QAEHPAVvtkCell@@@Z) referenced in function 
"public: __thiscall MyVTK::MyVTK(class QWidget *)" (??0MyVTK@@QAE at PAVQWidget@@@Z)
1>myvtk.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
public: static class vtkCylinderSource * __cdecl vtkCylinderSource::New(void)" 
(__imp_?New at vtkCylinderSource@@SAPAV1 at XZ) referenced in function "public: 
__thiscall MyVTK::MyVTK(class QWidget *)" (??0MyVTK@@QAE at PAVQWidget@@@Z)
1>myvtk.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) 
public: static class vtkSphereSource * __cdecl vtkSphereSource::New(void)" 
(__imp_?New at vtkSphereSource@@SAPAV1 at XZ) referenced in function "public: 
__thiscall MyVTK::MyVTK(class QWidget *)" (??0MyVTK@@QAE at PAVQWidget@@@Z)
1>release\bone_GUI.exe : fatal error LNK1120: 10 unresolved externals

Looking at the errors for the image writers (vtkBMPWriter etc), for example, I'm 
puzzled because I have included vtkIO.lib and vtkjpeg.lib, vtkpng.lib, 
vtktiff.lib and vtkzlib.lib.  What am I missing?



More information about the vtkusers mailing list