VTK Install Tips

I set out recently to install and use the C++ VTK libraries, either 4.4 or 5.0, with Microsoft Visual C++, either 6.0 or 7.0 .NET. I found, much to my dismay, that there are NO INSTRUCTIONS on the VTK web site. This caused me lots of pain so I thought I would share the fruits of my labor.

I found two decent install instructions on the internet. This PDF deals with version 4.1 and VC++ 6.0. This site deals with 4.x and VC++ .NET. Both of these deal with 4.x but everything is pretty much the same when setting up 5.0. These however were not enough to get me going, so if like you me you get stuck there are a few things you might want to consider.

First, ALL VTK .lib files, and any other .lib files you want to use, MUST be added into the project under either project | properties | linker | input | additional dependencies (.NET), or project | settings | link | input | object/library modules (6.0). This includes but is not limited to:

vtkCommon.lib vtkExpat.lib vtkFiltering.lib vtkFtgl.lib vtkFreeType.lib vtkGraphics.lib vtkHybrid.lib vtkImaging.lib vtkIO.lib vtkjpeg.lib vtkParallel.lib vtkpng.lib vtkRendering.lib vtkzlib.lib opengl32.lib glu32.lib

If you are getting a linker error something about unresolved externals make sure you have all .lib files you want to use in this list.

Second, the PDF talks about setting up tcl, this is not necessary if you just want to write C++ code.

Third, both of the above sites deal with building your own binaries from the source code. If you get pre-built binaries everything is the same except all of the .lib, .dll, and .h files are all grouped and stored in their own directories so you only have to set VC++ to point to these three directories instead of the 12 or so that you would if you built the binaries yourself.

Forth, if you set the Windows PATH environment variable and are unsure if it is working and easy way to check is to find a file that is the the directory you think you set it to, say vtkCommon.dll, open a command prompt and type “vtkCommon.dll”. If it says “unknown file” that directory is not stored properly in PATH, try restarting and check for typos. If it tried to open the .dll it is working.

Comments are closed.

%d bloggers like this: