Saturday, February 28, 2015

Compiling VTK 5.8.0 on Windows 64 with Visual Studio 2013

This is a quick post to cover the steps necessary to compile VTK 5.8.0, the most stable VTK 5 version in my experience, on Windows x64 with VS 2013 (to support Windows 8.1). The information is on the internet but scattered about so I thought I'd collect it just in case its useful for someone.

EDIT: Note that VTK 5.8.0 builds out of the box on Ubuntu 16.04 still, if you ensure that you uncomment the line with the define for GLX_GLXEXT_LEGACY in the Rendering/vtkXOpenGLRenderWindow.cxx file.

There are a few things that are incompatible with the new compiler. Firstly, the vtkOStreamWrapper error. This is covered in great detail here. Basically replace the offending line with:
//VTKOSTREAM_OPERATOR(ostream&);
vtkOStreamWrapper& vtkOStreamWrapper::operator << (ostream& a) {
    this->ostr << (void *)&a;
    return *this;
}
Then there are the ifstream->read() errors. Replace the
if ( this->IFile->read(result, 80) == 0)
with the
if ( this->IFile->read(result, 80).fail())
Lastly, there are the make_pair errors, solved here. You need to replace the
this->Map->insert(vtkstd::make_pair< vtkVariant, vtkVariant >(from, to));
with
this->Map->insert(vtkstd::make_pair(fromto)); // Addendum
in the vtkMapArrayValues.cxx file. You might need to add the include:
#ifdef _WINDOWS
  #include  // Addendum for vs11 to find 'greater'
#endif
to vtkAdjacencyMatrixToEdgeTable.cxx. I also had to add the above include and 
#include 
to vtkAdjacencyMatrixToEdgeTable.cxx, vtkNormalizeMatrixVectors.cxx, vtkPairwiseExtractHistogram2D.cxx, vtkParallelCoordinatesRepresentation.cxx, vtkChartXY.cxx, vtkControlPointsItem.cxx, to get rid of std max and min errors, 

HTHCheers Shakes - L3mming

No comments:

Post a Comment