[vtkusers] vtk6 porting question (segfault)

Trevor Irons trevorirons at gmail.com
Tue Aug 14 11:47:50 EDT 2012


Sorry if this has been asked before, but I couldn't find it.

I am having trouble porting an application over to VTK 6.0. I followed the
guide at
http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide

I am able to get my project to compile but I hit a seg fault at execution.
As a minimal example consider a pared down Cone.cxx from the Examples

// First include the required header files for the VTK classes we are using.
#include "vtkConeSource.h"
#include "vtkPolyDataMapper.h"

int main()
{

  vtkConeSource *cone = vtkConeSource::New();
  cone->SetHeight( 3.0 );
  cone->SetRadius( 1.0 );
  cone->SetResolution( 10 );

  vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
  coneMapper->SetInputConnection( cone->GetOutputPort() );
  //coneMapper->SetInputData( cone->GetOutput() );
// I tried this too

  exit(0);

}

I have been compiling with

g++ Cone.cxx -g -g3  -o testit  -I/usr/local/include/vtk-6.0/
-lvtkRenderingCore-6.0  -lvtkFiltersSources-6.0
-lvtkCommonExecutionModel-6.0

on

g++ --version
g++ (GCC) 4.7.1 20120721 (prerelease)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And when I execute, I just see a segmentation fault. I assume I am doing
something wrong, but I can't figure out what.

I ran it through gdb, but it just said the fault was in SetInputConnection,
or SetInputData, I tried both. This is with the tip of VTK from the git
repository.

Thanks for any suggestions.

-- Trevor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120814/3b268885/attachment.htm>


More information about the vtkusers mailing list