[vtkusers] Linking to VTK static libraries on Windows

Dave Partyka dave.partyka at kitware.com
Thu Oct 14 21:11:34 EDT 2010


The USE_SYSTEM flags are meant for linking in system installed/externally
built versions of these libraries. On Linux/Mac you can easily install
'development' versions of these libraries using their respective package
managers and then configure the USE_SYSTEM flags to point to those libraries
instead. On Windows you would have to build those libraries by hand so don't
worry about the USE_SYSTEM options.

Anyway, I am not entirely sure if link order matters but you might try
putting vtkCommon and vtkFiltering before vtkIO as nearly everything in VTK
depends on vtkCommon/vtkFiltering.

On Thu, Oct 14, 2010 at 7:43 PM, Gib Bogle <g.bogle at auckland.ac.nz> wrote:

> Maybe it's an issue with how I built the VTK libraries.  I wasn't sure if I
> should select VTK_USE_SYSTEM_PNG, _JPEG,_ZLIB and _TIFF, so I didn't.  In
> general I don't understand these VTK_USE_SYSTEM_* flags.
>
>
> On 15/10/2010 12:35 p.m., Dave Partyka wrote:
>
>> Are you linking vtkCommon and vtkFiltering as well?
>>
>> On Thu, Oct 14, 2010 at 7:32 PM, Gib Bogle <g.bogle at auckland.ac.nz
>> <mailto:g.bogle at auckland.ac.nz>> wrote:
>>
>>    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?
>>    _______________________________________________
>>    Powered by www.kitware.com <http://www.kitware.com>
>>
>>
>>    Visit other Kitware open-source projects at
>>    http://www.kitware.com/opensource/opensource.html
>>
>>    Please keep messages on-topic and check the VTK FAQ at:
>>    http://www.vtk.org/Wiki/VTK_FAQ
>>
>>    Follow this link to subscribe/unsubscribe:
>>    http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101014/5c9498ab/attachment.htm>


More information about the vtkusers mailing list