# VTK 9.3.0 static library build error with VS2019 compiler

**URL:** https://discourse.vtk.org/t/vtk-9-3-0-static-library-build-error-with-vs2019-compiler/13100
**Category:** Development
**Created:** [January 19, 2024, 9:04pm UTC](https://discourse.vtk.org/t/vtk-9-3-0-static-library-build-error-with-vs2019-compiler/13100 "2024-01-19T21:04:16Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dlrdave](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dlrdave/32/111_2.png) [@dlrdave](https://discourse.vtk.org/u/dlrdave)
#### Post date: [January 19, 2024, 9:04pm UTC](https://discourse.vtk.org/t/vtk-9-3-0-static-library-build-error-with-vs2019-compiler/13100/1 "2024-01-19T21:04:16Z")

</div>

I get the following, when attempting to build VTK 9.3.0 with BUILD\_SHARED\_LIBS=OFF and the VS2019 compiler:

vtkCommonCore-9.3.lib(vtkSMPToolsAPI.cxx.obj) : error LNK2019: unresolved external symbol “public: bool \_\_cdecl vtk::detail::smp::vtkSMPToolsImpl\<1\>::IsParallelScope(void)” (?IsParallelScope@?$vtkSMPToolsImpl@$00@smp@detail@vtk@@QEAA\_NXZ) referenced in function “public: bool \_\_cdecl vtk::detail::smp::vtkSMPToolsAPI::IsParallelScope(void)” (?IsParallelScope@vtkSMPToolsAPI@smp@detail@vtk@@QEAA\_NXZ)

Is this a known issue? Fixed in master already? Will a fix be put into a 9.3.1 release soon?

---

<div class="post-metadata">

### Author: ![dlrdave](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dlrdave/32/111_2.png) [@dlrdave](https://discourse.vtk.org/u/dlrdave)
#### Post date: [January 19, 2024, 9:34pm UTC](https://discourse.vtk.org/t/vtk-9-3-0-static-library-build-error-with-vs2019-compiler/13100/2 "2024-01-19T21:34:12Z")

</div>

UPDATE: happens in current master too

---

<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: [January 19, 2024, 9:41pm UTC](https://discourse.vtk.org/t/vtk-9-3-0-static-library-build-error-with-vs2019-compiler/13100/3 "2024-01-19T21:41:05Z")

</div>

What SMP backends do you have enabled? I recently fixed shared MSVC builds at least, but was testing with 2022.

Cc: @spyridon97

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [January 19, 2024, 9:41pm UTC](https://discourse.vtk.org/t/vtk-9-3-0-static-library-build-error-with-vs2019-compiler/13100/4 "2024-01-19T21:41:53Z")

</div>

The same link error is reported here: [https://gitlab.kitware.com/vtk/vtk/-/issues/19178](https://gitlab.kitware.com/vtk/vtk/-/issues/19178)

Probably best to add your voice there. In particular because the above issue was posted for VS2022, for a Debug build, and if you’re doing a Release build with VS2019 that’s an important data point.

---

<div class="post-metadata">

### Author: ![dlrdave](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dlrdave/32/111_2.png) [@dlrdave](https://discourse.vtk.org/u/dlrdave)
#### Post date: [January 19, 2024, 9:45pm UTC](https://discourse.vtk.org/t/vtk-9-3-0-static-library-build-error-with-vs2019-compiler/13100/5 "2024-01-19T21:45:00Z")

</div>

Re “What SMP backends do you have enabled?” – None explicitly, so whatever it defaults to

Re “the above issue was posted for VS2022, for a Debug build, and if you’re doing a Release build with VS2019 that’s an important data point” – thanks for the pointer to the issue, will do.

We are actually using VS 2022, but still with the VS 2019 toolset and CXX 17 standard.

---

<div class="post-metadata">

### Author: ![dlrdave](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dlrdave/32/111_2.png) [@dlrdave](https://discourse.vtk.org/u/dlrdave)
#### Post date: [January 23, 2024, 5:57pm UTC](https://discourse.vtk.org/t/vtk-9-3-0-static-library-build-error-with-vs2019-compiler/13100/6 "2024-01-23T17:57:35Z")

</div>

I went looking for differences in the various vtkSMPToolsImpl.txx files for the different backends, and this chunk popped out at me as possibly the cause of this problem:

> <https://github.com/Kitware/VTK/blob/6a8928918ade34498f54559d379ca4e6527ebd4f/Common/Core/SMP/STDThread/vtkSMPToolsImpl.txx#L129-L132>

The method causing the unresolved linker error is declared here for the STDThread backend, but never implemented anywhere. I am uncertain why this would only manifest with certain builds and not all, but … removing those 4 lines of declaration only code fixed the problem for me.

---

<div class="post-metadata">

### Author: ![dlrdave](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dlrdave/32/111_2.png) [@dlrdave](https://discourse.vtk.org/u/dlrdave)
#### Post date: [January 25, 2024, 10:03pm UTC](https://discourse.vtk.org/t/vtk-9-3-0-static-library-build-error-with-vs2019-compiler/13100/7 "2024-01-25T22:03:01Z")

</div>

In the issue discussion for [https://gitlab.kitware.com/vtk/vtk/-/issues/19178](https://gitlab.kitware.com/vtk/vtk/-/issues/19178), it was pointed out to me that there IS, in fact, an implementation for `vtkSMPToolsImpl<BackendType::STDThread>::IsParallelScope()`

See the discussion in the issue for a link to a commit that works around the problem, whatever its root cause. The workaround/fix in the commit eliminates the default method implementation, and implements it in each of the 4 individual backends instead.
