unresolved external symbol "void __cdecl vtkRenderingVolume_AutoInit_Construct(void)"

I am getting this error, vtk-9.5, static libs build with VS under WIndows10.

I googled the issue, AI suggested that VTK uses dynamic linking to link the rendering backend at runtime and with static linking that does not take place. It suggested I add these lines to the file where the rendering code is

#include <vtkAutoInit.h>

VTK_MODULE_INIT(vtkRenderingOpenGL2);

VTK_MODULE_INIT(vtkRenderingVolume);

I did and that did not work. The next thing was to add these preprocessor directives:

vtkRenderingOpenGL2_AUTOINIT=1(vtkRenderingGL2PSOpenGL2) vtkVolumeRenderingOpenGL2_AUTOINIT=1(vtkRenderingVolumeOpenGL2)

It did not work too.

Any ideas how to fix this issue?

Hi @jsemeda :waving_hand:. Could you please share the CMake flags used to build VTK? Also, the error is not visible in the original post. Could you please reshare?

I think your edits are in the right direction, but you also need to link to the targets involved in providing those factories. You’re probably missing a vtk_module_autoinit call in your CMake code.