[vtkusers] [FORGED] Unresolved externals when trying to compile my VTK sample project

Gib Bogle g.bogle at auckland.ac.nz
Sat Sep 5 16:50:58 EDT 2015


My suggestions, Dejan:
1) Don't put your own code in the VTK install tree.
2) Build your own applications with cmake.  This will take care of all the include files and libraries.  I suggest you start by finding one of the many online examples, which come complete with a CMakeLists.txt.  Then build your program using this example as a guide.  Cmake makes life very easy.

Gib
________________________________
From: vtkusers [vtkusers-bounces at vtk.org] on behalf of Dejan Zivkovic [dejan.zivkovic90 at gmail.com]
Sent: Sunday, 6 September 2015 8:29 a.m.
To: vtkusers at vtk.org
Subject: [FORGED] [vtkusers] Unresolved externals when trying to compile my VTK sample project

I got some unresolved externals when trying to compile my VTK sample project in Visual Studio 2010

I did the following steps:
1) Downloaded VTK 6.3 from GIT
2) Configured it with cmake for VisualStudio 2010 x64
3) Generated a VTK solution, and made an INSTALL release build

The result was the folder VTK in C:\ProgramFiles which has include and libs folders
that I intended to use for my solution.

Finally, I
- made an empty VS C++ project
- made a cpp files with copied sample code
- added include directories from C:\ProgramFiles\VTK\include
- set additional lib dir to C:\ProgramFiles\VTK\libs
- added all libs in the folder above to the linker input

And I get 15  unresolved externals:

1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall vtkRenderWindowInteractor::SetRenderWindow(class vtkRenderWindow *)" (__imp_?SetRenderWindow at vtkRenderWindowInteractor@@QAEXPAVvtkRenderWindow@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class vtkRenderWindowInteractor * __cdecl vtkRenderWindowInteractor::New(void)" (__imp_?New at vtkRenderWindowInteractor@@SAPAV1 at XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall vtkProp3D::RotateY(double)" (__imp_?RotateY at vtkProp3D@@QAEXN at Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall vtkProp3D::RotateX(double)" (__imp_?RotateX at vtkProp3D@@QAEXN at Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall vtkCamera::Zoom(double)" (__imp_?Zoom at vtkCamera@@QAEXN at Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class vtkCylinderSource * __cdecl vtkCylinderSource::New(void)" (__imp_?New at vtkCylinderSource@@SAPAV1 at XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class vtkRenderWindow * __cdecl vtkRenderWindow::New(void)" (__imp_?New at vtkRenderWindow@@SAPAV1 at XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class vtkProperty * __thiscall vtkActor::GetProperty(void)" (__imp_?GetProperty at vtkActor@@QAEPAVvtkProperty@@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class vtkActor * __cdecl vtkActor::New(void)" (__imp_?New at vtkActor@@SAPAV1 at XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class vtkPolyDataMapper * __cdecl vtkPolyDataMapper::New(void)" (__imp_?New at vtkPolyDataMapper@@SAPAV1 at XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall vtkRenderer::ResetCamera(void)" (__imp_?ResetCamera at vtkRenderer@@QAEXXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class vtkCamera * __thiscall vtkRenderer::GetActiveCamera(void)" (__imp_?GetActiveCamera at vtkRenderer@@QAEPAVvtkCamera@@XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall vtkRenderer::AddActor(class vtkProp *)" (__imp_?AddActor at vtkRenderer@@QAEXPAVvtkProp@@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class vtkRenderer * __cdecl vtkRenderer::New(void)" (__imp_?New at vtkRenderer@@SAPAV1 at XZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class vtkAlgorithmOutput * __thiscall vtkAlgorithm::GetOutputPort(void)" (__imp_?GetOutputPort at vtkAlgorithm@@QAEPAVvtkAlgorithmOutput@@XZ)
1>C:\Users\Dejan\documents\visual studio 2010\Projects\VTKTest\Release\VTKTest.exe : fatal error LNK1120: 15 unresolved externals

Can someone help? This has been bugging me for more than a day.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150905/672d8027/attachment.html>


More information about the vtkusers mailing list