[vtkusers] Help:How to compile c++ programme written with vtk?
jsowoc at gmail.com
Wed Jun 1 17:27:53 EDT 2005
> The document I found suggests me use cmake, but I am not familiar
> with it. What should I do? Is there an easy way to compile the programme?
CMake is called "cross-platform make" which is supposed to mean that
you can write a CMake script that will generate a makefile if you are
under Linux, or a Visual Studio workspace if you are under Windows,
and a few other operating systems.
Based on your e-mail, I assume you are using some version of Linux.
Get CMake first. One can obtain the current version from:
To compile programs (like VTK), you need a compiler. One most likely
came with your distro, possibly as an optional package. Look for "GCC
- The GNU Compiler Collection". GCC 4.0 does not seem to work
correctly, so stick with 3.4.4
Unlike gtk which is a system package, vtk needs to be manually
configured and installed.
Install GCC and CMake. Extract vtk, and go into the directory. Type:
You will be asked for backward compatibility, but since vtk works with
2.0, just hit "c".
You will then be presented with a myriad of options, and depending on
what you want, you can select or deselect them. In your case, you want
to make sure "build shared libraries" is turned on.
When you are done changing options, hit "c" again. Some new options
may pop up, and you can change them if you wish. Keep hitting "c"
until all the asterisks go away. Now you can hit "g" to generate the
>From here, you do what you would with any other program. Type "make"
and then as root type "make install".
Depending on how many options you choose and how fast your computer
is, the make command can take anywhere from a few minutes to a few
More information about the vtkusers