# unresolved external symbol "void \_\_cdecl vtkRenderingVolume\_AutoInit\_Construct(void)"

**URL:** https://discourse.vtk.org/t/unresolved-external-symbol-void-cdecl-vtkrenderingvolume-autoinit-construct-void/16478
**Category:** Support
**Created:** [July 3, 2026, 9:25pm UTC](https://discourse.vtk.org/t/unresolved-external-symbol-void-cdecl-vtkrenderingvolume-autoinit-construct-void/16478 "2026-07-03T21:25:39Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jsemeda](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jsemeda/32/10714_2.png) [@jsemeda](https://discourse.vtk.org/u/jsemeda)
#### Post date: [July 3, 2026, 9:25pm UTC](https://discourse.vtk.org/t/unresolved-external-symbol-void-cdecl-vtkrenderingvolume-autoinit-construct-void/16478/1 "2026-07-03T21:25:39Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [July 5, 2026, 6:46pm UTC](https://discourse.vtk.org/t/unresolved-external-symbol-void-cdecl-vtkrenderingvolume-autoinit-construct-void/16478/2 "2026-07-05T18:46:16Z")

</div>

Hi @jsemeda 👋. 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?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [July 20, 2026, 5:05pm UTC](https://discourse.vtk.org/t/unresolved-external-symbol-void-cdecl-vtkrenderingvolume-autoinit-construct-void/16478/3 "2026-07-20T17:05:13Z")

</div>

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](https://docs.vtk.org/en/latest/api/cmake/ModuleSystem.html#autoinit) in your CMake code.

---

<div class="post-metadata">

### Author: ![jsemeda](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jsemeda/32/10714_2.png) [@jsemeda](https://discourse.vtk.org/u/jsemeda)
#### Post date: [August 3, 2026, 2:26am UTC](https://discourse.vtk.org/t/unresolved-external-symbol-void-cdecl-vtkrenderingvolume-autoinit-construct-void/16478/4 "2026-08-03T02:26:56Z")

</div>

How should I do that? Does attaching the cmake file here help?

The full error is :

error LNK2019: unresolved external symbol “void \_\_cdecl vtkVolumeRenderingOpenGL2\_AutoInit\_Construct(void)” (?vtkVolumeRenderingOpenGL2\_AutoInit\_Construct@@YAXXZ) referenced in function “public: \_\_cdecl `anonymous namespace’::vtkVolumeRenderingOpenGL2\_ModuleInit::vtkVolumeRenderingOpenGL2\_ModuleInit(void)” (??0vtkVolumeRenderingOpenGL2\_ModuleInit@?A0x43c0deb8@@QEAA@XZ)

---

<div class="post-metadata">

### Author: ![jsemeda](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jsemeda/32/10714_2.png) [@jsemeda](https://discourse.vtk.org/u/jsemeda)
#### Post date: [August 3, 2026, 3:54am UTC](https://discourse.vtk.org/t/unresolved-external-symbol-void-cdecl-vtkrenderingvolume-autoinit-construct-void/16478/5 "2026-08-03T03:54:04Z")

</div>

I added

# Enable auto-initialization for the target and modules

vtk\_module\_autoinit(

TARGETS MyVTKApp

MODULES ${VTK\_LIBRARIES}

)

but it did not help. I tried replacing the ${VTK\_LIBRARIES} with the missing module name from the error, vtkVolumeRenderingOpenGL2, but it gave an error in the cmake file.

---

<div class="post-metadata">

### Author: ![jsemeda](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jsemeda/32/10714_2.png) [@jsemeda](https://discourse.vtk.org/u/jsemeda)
#### Post date: [August 3, 2026, 4:12am UTC](https://discourse.vtk.org/t/unresolved-external-symbol-void-cdecl-vtkrenderingvolume-autoinit-construct-void/16478/6 "2026-08-03T04:12:06Z")

</div>

I also tried

vtk\_module\_autoinit(  
TARGETS dicom2meshlib  
MODULES vtk::CommonCore  
vtk::RenderingCore  
vtk::RenderingOpenGL2  
vtk::RenderingVolume  
vtk::RenderingVolumeOpenGL2  
vtk::InteractionStyle  
)

did not work. I am following what is in the documentaion, but maybe the way I am listing the modules is not correct? Maybe the module names? although when I write this in the cmake file the autocomplete is listing these modules as written.

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [August 3, 2026, 1:37pm UTC](https://discourse.vtk.org/t/unresolved-external-symbol-void-cdecl-vtkrenderingvolume-autoinit-construct-void/16478/7 "2026-08-03T13:37:26Z")

</div>

I’ve seen this in the past when devs try to write the module init themselves and fumble on the module names.

> vtkVolumeRenderingOpenGL2\_AUTOINIT=1(vtkRenderingVolumeOpenGL2)

You’ve transposed the module name. It should be `vtkRenderingVolumeOpenGL2_AUTOINIT=...` That might explain why you saw `error LNK2019: unresolved external symbol “void __cdecl vtkVolumeRenderingOpenGL2_AutoInit_Construct`.

When you tried autoinit, did you remove the manual module init and try again? Maybve stale `VTK_AUTOINIT` define in cache/add\_definitions from incorrect build is being carried forward. Try to delete your build directory and re-configure from scratch using the autoinit.

What I can suggest to you is don’t hand-write VTK\_MODULE\_INIT / VTK\_AUTOINIT defines. Let CMake do it. Call `find_package` with the components you need. They will be placed in `VTK_LIBRARIES`

```c
# CMakeLists.txt
find_package(VTK REQUIRED COMPONENTS
  CommonCore
  InterationStyle
  RenderingCore
  RenderingVolume
  RenderingVolumeOpenGL2
  RenderingOpenGL2
)
target_link_libraries(dicom2meshlib PRIVATE ${VTK_LIBRARIES}) # needed
vtk_module_autoinit(TARGETS dicom2meshlib MODULES ${VTK_LIBRARIES}) # also needed

```
