Download VTK 5.10.1
Download VS2010
Download CMake 3.2.0
I assume you ' ve already installed VS2010 and CMake 3.2.0 correctly.
Compile the VTK:
Start CMake 3.2.0, fill the source and destination:
Source: c:/vtk5.10.1/vtk5.10.1
Destination: c:/vtk5.10.1/vs2010
Click Configure and use Visual Studio ten to Complie.
When first configure are done, select grouped and advanced.
Build_examples [On] Build_test [on] cmake_install_prefix [C:/vtk5. 10.1/Vs2010_install] cmake_use_pthreads [off]cmake_use_win32_threads [on]
Click Configure again.
After configure was done (No errors show), click Generate.
Go Your build folder, open VTK.sln, right click all_build, choose Rebuild.
Wait a long time for make process, with a cup of coffee:)
After rebuild is do, right click INSTALL, choose Build.
Now, the configuration was done, enjoy it:)
Create a new Empty project,
Project->project property->configuration properties->vc++directories->Include Directories:
C:\VTK5.10.1\VS2010
C:\VTK5.10.1\VS2010\bin
C:\VTK5.10.1\VTK5.10.1\GenericFiltering
C:\VTK5.10.1\VTK5.10.1\Common
C:\VTK5.10.1\VTK5.10.1\IO
C:\VTK5.10.1\VTK5.10.1\Filtering
C:\VTK5.10.1\VTK5.10.1\Rendering
C:\VTK5.10.1\VTK5.10.1\Graphics
C:\VTK5.10.1\VTK5.10.1\olumeRendering
C:\VTK5.10.1\VTK5.10.1\Imaging
C:\VTK5.10.1\VTK5.10.1\Hybrid
C:\VTK5.10.1\VTK5.10.1\GUISupport
C:\VTK5.10.1\VTK5.10.1\Utilities
C:\VTK5.10.1\VS2010\Utilities
C:\VTK5.10.1\VTK5.10.1\Parallel
C:\VTK5.10.1\VTK5.10.1\Widgets
Project->project property->configuration properties->vc++directories->Library Directories:
C:\VTK5.10.1\VS2010\bin\Debug
Project->project property->configuration Properties->linker->input:
Opengl32.lib
Kernel32.lib
User32.lib
Gdi32.lib
Winspool.lib
Comdlg32.lib
Advapi32.lib
Shell32.lib
Ole32.lib
Oleaut32.lib
Uuid.lib
Odbc32.lib
VtkCommon.lib
VtkDICOMParser.lib
VtkexoIIc.lib
Vtkexpat.lib
VtkFiltering.lib
Vtkfreetype.lib
Vtkftgl.lib
VtkGenericFiltering.lib
VtkGraphics.lib
VtkHybrid.lib
VtkImaging.lib
VtkIO.lib
Vtkjpeg.lib
VtkNetCDF.lib
Vtkpng.lib
VtkRendering.lib
Vtksys.lib
Vtktiff.lib
VtkVolumeRendering.lib
VtkWidgets.lib
Vtkzlib.lib
Create a test.cpp file as below:
#include <vtkConeSource.h>#include<vtkPolyData.h>#include<vtkSmartPointer.h>#include<vtkPolyDataMapper.h>#include<vtkActor.h>#include<vtkRenderWindow.h>#include<vtkRenderer.h>#include<vtkRenderWindowInteractor.h>intMainint,Char*[]){ //Create a coneVtksmartpointer<vtkconesource> Conesource =Vtksmartpointer<vtkConeSource>:: New (); Conesource-Update (); //Create a mapper and actorVtksmartpointer<vtkpolydatamapper> mapper =Vtksmartpointer<vtkPolyDataMapper>:: New (); Mapper->setinputconnection (conesource->Getoutputport ()); Vtksmartpointer<vtkActor> actor =Vtksmartpointer<vtkActor>:: New (); Actor-Setmapper (mapper); //Create A renderer, Render window, and InteractorVtksmartpointer<vtkrenderer> renderer =Vtksmartpointer<vtkRenderer>:: New (); Vtksmartpointer<vtkRenderWindow> Renderwindow =Vtksmartpointer<vtkRenderWindow>:: New (); Renderwindow-addrenderer (renderer); Vtksmartpointer<vtkRenderWindowInteractor> Renderwindowinteractor =Vtksmartpointer<vtkRenderWindowInteractor>:: New (); Renderwindowinteractor-Setrenderwindow (Renderwindow); //ADD The actors to the sceneRenderer->Addactor (actor); Renderer->setbackground (.3, .2, .1);//Background color Dark red//Render and InteractRenderwindow->Render (); Renderwindowinteractor-Start (); returnexit_success;}
If error Lnk2038:mismatch detected for ' _iterator_debug_level ': value ' 0 ' doesn ' t match value ' 2 ' occurs, please See solution here.
VTK 5.10.1 VS2010 configuration