C++
Tutorial
Part 1

C++ Part 1: Installing, configuring, and testing C++ and VTK
using Visual Studio 6

This tutorial shows how to install vtk for use in Visual C++ 6.0, however the process is nearly identical for Visual C++ .NET.

Download the following files:

 

Installing

Install both of the above files. Take note of where these files are installed as you will need to know later. For this example we are installing it to c:\vtk40

Launch Visual C++ select File->New. In the new dialog box that comes up select the projects tab and choose Win32 Console Application. Under location Choose the folder where you wish this project to be created and type a name for this project. Then click OK.

Now in the following dialog box select An empty project and click finish.

Now we need to add our sample source file. In the directory where you installed vtk40CPP (example: c:\vtk40) there should be a folder called CxxExample in that folder there is a file called Cone.cxx. Copy that file to the location where you chose for your Visual C++ project.

Select the FileView tab and right-click on the Source Files folder. Choose the Add Files to Folder option. Select the Cone.cxx file.

Now select the Tools->Options menu. You should get the following window.

Select the Directories tab, and make sure the Show directories drop-down is set to include files. Click the new button (the icon to the left of the red X).

Click on the browse button. In the dialog box that shows up browse to the location where the C++ header files are located. Example: C:\VTK40\INCLUDE\VTK then click OK. Click OK to exit the dialog box. Next we need to include the vtk library files. Select Project->Settings. You should get the following dialog box.

Make sure the project itself is selected, then click on the Link tab. Under Category select input. Under Additional library path enter the path to the vtk library files. If you installed to c:\vtk40 then they will be located in C:\vtk40\lib\vtk

For this we will need to link the following files:

vtkRendering
vtkGraphics
vtkImaging
vtkFiltering
vtkCommon

To do so in the Object/Library modules enter each library name ending with a .lib extension. Example: vtkRendering.lib

After this select OK. Now we are finally ready to compile.

Select Build->Execute.

The program should load up and you should see a spinning cone. If so then the install is successful. For any future C++ VTK programs you will need to repeat the inclusion of the library files as well as setting the include paths.

Home
C++ Tutorial
Python Tutorial
TCL/TK Tutorial

Downloads
Homework
About Us
Contact
Links

C++ Tutorial
Part 1: VS 6
Part 2: VS .NET
Part 3: SUU Logs