1

I built and configured VTK using cmake in visual studio according to the link below:

http://vtkblog.blogspot.com/2007/04/install-build-vtk-from-source-in-visual.html

But I get linking errors as below:

1>vtk_minimal.obj : error LNK2019: unresolved external symbol "public: static class vtkInteractorStyleTrackballCamera * __cdecl vtkInteractorStyleTrackballCamera::New(void)" (?New@vtkInteractorStyleTrackballCamera@@SAPAV1@XZ) referenced in function _main 1>vtk_minimal.obj : error LNK2019: unresolved external symbol "public: void __thiscall vtkRenderWindowInteractor::SetRenderWindow(class vtkRenderWindow *)" (?SetRenderWindow@vtkRenderWindowInteractor@@QAEXPAVvtkRenderWindow@@@Z) referenced in function _main 1>vtk_minimal.obj : error LNK2019: unresolved external symbol "public: static class vtkRenderWindowInteractor * __cdecl vtkRenderWindowInteractor::New(void)" (?New@vtkRenderWindowInteractor@@SAPAV1@XZ) referenced in function _main 1>vtk_minimal.obj : error LNK2019: unresolved external symbol "public: static class vtkRenderWindow * __cdecl vtkRenderWindow::New(void)" (?New@vtkRenderWindow@@SAPAV1@XZ) referenced in function _main 1>vtk_minimal.obj : error LNK2019: unresolved external symbol "public: void __thiscall vtkRenderer::AddActor(class vtkProp *)" (?AddActor@vtkRenderer@@QAEXPAVvtkProp@@@Z) referenced in function _main 1>vtk_minimal.obj : error LNK2019: unresolved external symbol "public: static class vtkRenderer * __cdecl vtkRenderer::New(void)" (?New@vtkRenderer@@SAPAV1@XZ) referenced in function _main 1>vtk_minimal.obj : error LNK2019: unresolved external symbol "public: static class vtkActor * __cdecl vtkActor::New(void)" (?New@vtkActor@@SAPAV1@XZ) referenced in function _main 1>vtk_minimal.obj : error LNK2019: unresolved external symbol "public: static class vtkPolyDataMapper * __cdecl vtkPolyDataMapper::New(void)" (?New@vtkPolyDataMapper@@SAPAV1@XZ) referenced in function _main 1>vtk_minimal.obj : error LNK2019: unresolved external symbol "public: static class vtkConeSource * __cdecl vtkConeSource::New(void)" (?New@vtkConeSource@@SAPAV1@XZ) referenced in function _main 1>vtk_minimal.obj : error LNK2019: unresolved external symbol "public: class vtkAlgorithmOutput * __thiscall vtkAlgorithm::GetOutputPort(int)" (?GetOutputPort@vtkAlgorithm@@QAEPAVvtkAlgorithmOutput@@H@Z) referenced in function "public: class vtkAlgorithmOutput * __thiscall vtkAlgorithm::GetOutputPort(void)" (?GetOutputPort@vtkAlgorithm@@QAEPAVvtkAlgorithmOutput@@XZ) 1>Debug/../bin/vtk_minimal_d.exe : fatal error LNK1120: 10 unresolved externals

Please help me.

5
  • Are you sure that you specified the VTK libraries in the Linker -> Input -> "Additional Dependencies" property? Commented Jan 18, 2012 at 7:16
  • I have included vtk in library and include sections in Tools->options->VC++ directories. How do I add it to Additional dependancies? Do I have to add all the libs? Commented Jan 18, 2012 at 7:27
  • You have to tell the linker where to find the definitions of the functions that you're calling. I told you where to find the setting. Look in your project's Properties. Commented Jan 18, 2012 at 7:28
  • Thanks Cody Gray. I added all the libs, but stil getting the error. :( Commented Jan 19, 2012 at 3:09
  • Check your calling conventions then. Make sure that you're not compiling the project with the /Gz switch or explicitly specifying a different calling convention for the functions provided by the library. The error message that you posted appears to indicate that the functions are declared __cdecl. Commented Jan 20, 2012 at 2:20

1 Answer 1

0

You should be using CMake to configure VTK before building. Here are some instructions: http://www.vtk.org/Wiki/VTK/Building/Windows

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.