'vtk6.3 link error:no override found for 'vtkRenderWindow'

I hava built vtk6.3 with qt5.5 on ubuntu 64bit,and I open an example with qtcreator.Build it,then link error occur:

Generic Warning: In /VTK/Rendering/Core/vtkRenderWindow.cxx, line 40 Error: no override found for 'vtkRenderWindow'.

The line 40 with doc:

//Use the vtkAbstractObjectFactoryNewMacro to allow the object factory overrides. vtkAbstractObjectFactoryNewMacro(vtkRenderWindow)

I google for this problem,almost all explanation is about this link,it seems I must add this macro in my cpp file to enable the factory methord:

include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRenderingWindow)

But I got another error:

error: undefined reference to `vtkRenderingWindow_AutoInit_Construct()' error: undefined reference to `vtkRenderingWindow_AutoInit_Destruct()'

I can't find any built library define these symbols,google it and I got almost nothing.I am new to vtk,can anyone give some help?



Solution 1:[1]

Use VTK_MODULE_INIT(vtkRenderingOpenGL) instead of VTK_MODULE_INIT(vtkRenderingWindow). It works for me.

Solution 2:[2]

this is an old thread, but just in case... If you are not using cmake with your VTK project you may run into the link "error: undefined reference to". How can you find out the right library out of the (v6.1: 377) vtk libraries available, when the documentation gives no hint? Solution: in headers there usually is an EXPORT macro like this:

class VTKCOMMONDATAMODEL_EXPORT vtkCellArray 

this gives a hint for the library: in this case libvtkCommonDataModel

In regardto the problem with

undefined reference to `vtkRenderingOpenGL2_AutoInit_Construct()'

I had used the macro

#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2)

Solution: on my system there is only a libvtkRenderingOpenGL. So change the VTK_MODULE_INIT line and add linker option -lvtkRenderingOpenGL to the command.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 fblupi
Solution 2