[vtk-developers] VTK_MAJOR_VERSION is no longer #define'ed

Brad King brad.king at kitware.com
Wed Apr 25 11:07:59 EDT 2012


On 4/25/2012 11:02 AM, David Gobbi wrote:
> On Wed, Apr 25, 2012 at 8:55 AM, Brad King<brad.king at kitware.com>  wrote:
>>
>> If your goal is to write code that works with multiple versions of
>> VTK I don't think including a header with "Version" in its name
>> is too much to ask.
>
> I may be missing something here, but in VTK 5.x that header doesn't
> exist, so how can it be included in code that is meant to run on
> multiple versions of VTK?

The "vtkVersion.h" header has always existed and it includes the
new header.  Just do:

  #include "vtkVersion.h"
  #if VTK_MAJOR_VERSION <= 5
  ...
  #endif

and it will work in all versions.  The only reason the new header
exists is to allow C sources to include it without getting the
vtkVersion class.

-Brad



More information about the vtk-developers mailing list