[vtkusers] Qt + VTK 64-bit access violations

sean.larkin at lickenbrocktech.com sean.larkin at lickenbrocktech.com
Fri Jan 10 15:03:26 EST 2014


I've just started using Qt and VTK on 64-bit Windows.  I built both Qt
and VTK from source code and installed them without problem, and
installed the VS-Qt plugin.  I downloaded a couple of Qt-VTK C++ example
projects.  I built the project file for VS2010 with Cmake.  These
example projects compile and run fine and without errors.  After this I
began to build my first Qt-VTK project with VS2010(no Cmake).  I
designed a simple user interface with the Qt designer.  It has a tab
control, QVTKWidget, and a splitter between them.  There are no slots
defined.  When I changed the name of the QVTKWidget object it caused
Intellisense errors, as it said that the ui class did not contain this
new name.  I remedied this by converted the project to a Qt add-in (Is
this a good thing to do?).  I then added a few member variables to the
qwindow derived class, and the corresponding include statements.  When I
tried to compile this I got errors regarding function definitions or
something.  To fix this I added the proper libraries to the additional
dependencies in the Linker\Input setting.  This confused me, as i
thought it would link to the .dll files defined elsewhere, and not to
the static .lib files.  Is this correct?  The Qt-VTK example projects
link to the .lib files, but I didn't think it was necessary considering
the presence of the .dll's.  Everything built fine, and the interface
would popup if I ran it, but the qvtkwidget didn't have anything in it,
it was transparent, and when I dragged the mouse across it I got access
violations.  So I started to add an object for rendering into the
qwindows constructor code.  I added this code from one of the examples:
vtkSmartPointer<vtkSphereSource> sphereSource = 
      vtkSmartPointer<vtkSphereSource>::New();
  sphereSource->Update();
  vtkSmartPointer<vtkPolyDataMapper> sphereMapper =
      vtkSmartPointer<vtkPolyDataMapper>::New();
  sphereMapper->SetInputConnection(sphereSource->GetOutputPort());
  vtkSmartPointer<vtkActor> sphereActor = 
      vtkSmartPointer<vtkActor>::New();
  sphereActor->SetMapper(sphereMapper);



It compiles fine and I run it and get this error in a message box:
Unhandled exception at 0x000000013f751e3c in QTVTKRender.exe:
0xC0000005: Access violation reading location 0x0000000000000000.



And in the command window I get a generic warning: In... (this path
leads to the source code where I compiled the VTK)
And the next line I get: Error: no override found for
'vtkPolyDataMapper'.


The user interface never appears and I have to break out.  I put a break
point on the constructor, and the code never even reaches it.  Any ideas
what is going on here?


Thanks,
Sean


More information about the vtkusers mailing list