Author: Jing Li

Updated time: 06-July-2003

 

Building VTK 4.x using VS .Net 2003 and Installing it on Windows

 

The published pre-compiled binaries of VTK 4.2 on the VTK org home page is built using VC6, which uses old (no-ANSI) standard header files, such as the stream header file -- iostream.h. You can download vtk42-LatestRelease.exe and install it on the windows pc, and use it with VC6 or VS .Net 2002 without any problem.

If you want to use VTK with VS .Net 2003, you have to build VTK binaries which are vtk*.lib and vtk*.dll files using VS .Net 2003 from VTK source codes as VS .Net 2003 does not support the old-fashioned c++ header files any more.

 

Part One: How to build VTK binaries

 

Step 1. Download VTK-4.2-LatestRelease.zip from http://public.kitware.com/VTK/get-software.php to your harddisk, and uppack them to C:\VTK42 folder.

 

Step 2. Download VTKData-4.2.zip from http://public.kitware.com/VTK/get-software.php to your harddisk, and uppack them to C:\VTKData-4.2 folder in case that you want to build vtk examples.

 

Step 3. Create a folder C:\VTKBin to store the compiled binaries.

 

Step 4. Download CMSetup202.exe from http://www.cmake.org/HTML/Download.html and install it, which is a new cross platform build tool. You need it to build the VTK binaries from VTK source codes.

 

Step 5. Start CMake, provide the souce codes and binaries pathes and the compiler to CMake, then press Configure button to let CMake read the CMakeLists.txt from the souce path and configure the variables. Make sure turn on


If you want to build VTK examples, you can choose ture on BUILD_EXAMPLES. Then press OK to build the VTK solution, which is created in the C:\VTKBin42.

 

Step 6. Open the VTK.sln from C:\VTKBin42 using VS .Net 2003 and build it in Release mode. The building takes nearly one hour on a PC with Pentium 4 CPU 1.80GHz.

 

Part Two: How to Install VTK binaires on Windows PC

 

Step 1. Copy vtk*.dll files from C:\VTKBin42\bin\release to c:\windows\system32.

 

Step 2. Set up VS .Net 2003 by tell the IDE the directories that hold the vtk include header files and vtk library files. Go to Tools, Options, Projects. Select VC++ Directories, Under the list for Library files add: “C:\VTKBin42\bin\release”. Under the list for Include files add:

Another way is adding the directories of VTK hearder and library files to each project rather than to the IDE. The header files can be added from Project Property Page->C/C++->Additional Include Directories; the library directories can be added from Project Property Page->Linker->Additional Library Directories. If you work at the lab, have not adminstrator rights to access the machine, you'd better set up the directories like this way as the header and library directories setting can be saved to your projects.

Step 3. To use VTK in your project, vtk*.libs need to be added to the project setting. Go to Project, open Properties page, select Linker list, in the Input category, add vtk*.libs to the Additional Dependencies, which are vtkCommon.lib vtkFiltering.lib vtkGraphics.lib vtkHybrid.lib vtkImaging.lib vtkIO.lib vtkpng.lib vtkjpeg.lib vtkParallel.lib vtkRendering.lib vtkzlib.lib (please note there is a space between each library name)

 

 

In the notes, I describes how to build VTK 4.2 binaries using VS .Net 2003 and install it on winodws PC. You can build the lastest interim release VTK 4.4 using the same methods.

 

Reference: Rasmus Paulsen, Installing VTK 4.1.x on a windows PC. http://cosmolab.cineca.it/docs/jan10-2003/VTK%20upgrade/PCInstallationVTK4.0.pdf