# VTK\_MODULE\_INIT help

**URL:** https://discourse.vtk.org/t/vtk-module-init-help/972
**Category:** Support
**Created:** [May 15, 2019, 3:38pm UTC](https://discourse.vtk.org/t/vtk-module-init-help/972 "2019-05-15T15:38:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![langer](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/3e96dc/32.png) [@langer](https://discourse.vtk.org/u/langer)
#### Post date: [May 15, 2019, 3:38pm UTC](https://discourse.vtk.org/t/vtk-module-init-help/972/1 "2019-05-15T15:38:55Z")

</div>

Hi –

I have a C++ project that doesn’t use cmake, so vtk modules are loaded by explicitly listing the libraries in the linker arguments and using VTK\_MODULE\_INIT calls in the code. What is the best way to figure out which libraries to link and which modules to use with VTK\_MODULE\_INIT?

I tried using

> WhatModulesVTK.py \<vtk source\> \<my source\>

It listed a bunch of modules in the minimal set, so I included them all in VTK\_MODULE\_INIT calls. At run time I got messages like this:

> dyld: Symbol not found: \_\_Z39vtkFiltersExtraction\_AutoInit\_Constructv  
> Referenced from: /Users/langer/stow/oof3d-development-debug3d-cocoa-2.7/lib/liboof3dcommon.dylib  
> Expected in: flat namespace

despite linking with -lvtkFiltersExtraction-8.2. In fact,

> % nm -gUA libvtk\*.dylib | grep FiltersExtraction\_AutoInit\_Construct

doesn’t find anything.

How can I find out what modules and libraries need to be included for a given VTK feature? Am I using VTK\_INIT\_MODULE or WhatModulesVTK.py incorrectly? Or, if FiltersExtraction\_AutoInit\_Construct is undefined, does it mean that I’ve built VTK incorrectly?

(FiltersExtraction is just the first of the modules listed by WhatModulesVTK.py that causes a problem – if I omit its VTK\_MODULE\_INIT the program actually compiles and runs. But I thought I should be able to include all of the modules that WhatModulesVTK.py lists. The actual reason that I tried using it is that I am trying to use vtkGL2PSExporter and can’t figure out how. The program will link but fails at run time with “Error: no override found for 'vtkGL2PSExporter”.)

I’m using VTK 8.2.0 on macOS Mojave.

Thanks,  
Steve

---

<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: [May 15, 2019, 5:02pm UTC](https://discourse.vtk.org/t/vtk-module-init-help/972/2 "2019-05-15T17:02:51Z")

</div>

The only modules which have an AutoInit\_Construct call are those which implement object factories. FiltersExtraction doesn’t have any, so the linker error makes sense. As for finding out which modules need autoinit magic…it’s not trivial without CMake. I’d look at the modules which you use directly and then search for modules which have `_IMPLEMENTS` variables set in their associated module file (`<module>.cmake` file near the in-use `VTKConfig.cmake` file which have those modules in their values. With this list, you can then do the equivalent of `#define vtkRenderingCore_AUTOINIT 2(vtkRenderingOpenGL2,vtkRenderingFreeType)` somewhere. The count before the parentheses is the number of arguments in the parens.

It may also be easier to just do whack-a-mole if the number of in-use object factories is low.

---

<div class="post-metadata">

### Author: ![langer](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/l/3e96dc/32.png) [@langer](https://discourse.vtk.org/u/langer)
#### Post date: [May 15, 2019, 8:54pm UTC](https://discourse.vtk.org/t/vtk-module-init-help/972/3 "2019-05-15T20:54:38Z")

</div>

Thank you. That was useful.

I discovered that searching for the “no override” name in build/lib/cmake/vtk-8.2/Modules/\*.cmake finds it in a file whose name contains the name of the module that has to be passed to VTK\_MODULE\_INIT. Is that a reliable method?

– Steve

---

<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: [May 16, 2019, 12:58am UTC](https://discourse.vtk.org/t/vtk-module-init-help/972/4 "2019-05-16T00:58:20Z")

</div>

Possibly. I suspect that appears in the list of headers associated with the module. If that’s the case, then yes, it is reliable.
