[vtkusers] error while using static libraries

Brad King brad.king at kitware.com
Tue Feb 17 12:59:51 EST 2004


varshini varshini wrote:
> hai all,
> 
> I am using vtk for the past couple of months.I am able to compile and 
> use successfully when I use shared libraries for one of my projects. But 
> when I try to use static libraries I get linking errors.I have pasted 
> the errors below:
> 
> error LNK2001: unresolved external symbol "__declspec(dllimport) public: 
> int __thiscall vtkXMLWriter::Write(void)" 
> (__imp_?Write at vtkXMLWriter@@QAEHXZ)
> error LNK2001: unresolved external symbol "__declspec(dllimport) public: 
> void __thiscall vtkXMLWriter::SetByteOrderToLittleEndian(void)" 
> (__imp_?SetByteOrderToLittleEndian at vtkXMLWriter@@QAEXXZ)
> error LNK2001: unresolved external symbol "__declspec(dllimport) public: 
> void __thiscall vtkXMLWriter::SetByteOrderToBigEndian(void)" 
> (__imp_?SetByteOrderToBigEndian at vtkXMLWriter@@QAEXXZ)
> error LNK2001: unresolved external symbol "__declspec(dllimport) public: 
> void __thiscall vtkXMLImageDataWriter::SetInput(class vtkImageData *)" 
> (__imp_?SetInput at vtkXMLImageDataWriter@@QAEXPAVvtkImageData@@@Z)
> error LNK2001: unresolved external symbol "__declspec(dllimport) public: 
> static class vtkXMLImageDataWriter * __cdecl 
> vtkXMLImageDataWriter::New(void)" 
> (__imp_?New at vtkXMLImageDataWriter@@SAPAV1 at XZ)
> fatal error LNK1120: 5 unresolved externals
> 
> 
> does anyone know how to remove these errors.

You are missing a line like

TARGET_LINK_LIBRARIES(myapp vtkIO)

in your CMake code.

-Brad




More information about the vtkusers mailing list