# vtk 9.6.2 msvc2022 C++20 using issue

**URL:** https://discourse.vtk.org/t/vtk-9-6-2-msvc2022-c-20-using-issue/16466
**Category:** Support
**Created:** [June 18, 2026, 7:37pm UTC](https://discourse.vtk.org/t/vtk-9-6-2-msvc2022-c-20-using-issue/16466 "2026-06-18T19:37:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![APlenkin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aplenkin/32/10672_2.png) [@APlenkin](https://discourse.vtk.org/u/APlenkin)
#### Post date: [June 18, 2026, 7:37pm UTC](https://discourse.vtk.org/t/vtk-9-6-2-msvc2022-c-20-using-issue/16466/1 "2026-06-18T19:37:09Z")

</div>

Hello,

I am continue migration to 9.6.2 and now I have issue building my project with vtk with c++20 (no issue for c++17).

I got error

Error C7595 ‘vtkfmt::v12::fstring\<bool &,bool &,const bool &\>::fstring’: call to immediate function is not a constant expression vtk-9.6\vtkTimerLog.h 119

it is here

```auto
VTK_FORMAT_IF_ERROR_RETURN(
  auto result = vtk::format_to_n(event, sizeof(event), format, std::forward<T>(args)...);
  *result.out = '\0', );

```

changing here to

```auto
VTK_FORMAT_IF_ERROR_RETURN(
  auto result = vtk::format_to_n(event, sizeof(event), fmt::runtime(format), std::forward<T>(args)...);
  *result.out = '\0', );

```

solve issue. But I am not sure is it good. Or probably it could be patched in future.

I will be happy for some advices for this issue.

Andrey

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [June 18, 2026, 11:40pm UTC](https://discourse.vtk.org/t/vtk-9-6-2-msvc2022-c-20-using-issue/16466/2 "2026-06-18T23:40:32Z")

</div>

Hello,

Please, you could report that here: [https://gitlab.kitware.com/vtk/vtk/-/work\_items](https://gitlab.kitware.com/vtk/vtk/-/work_items) .

best,

PC

---

<div class="post-metadata">

### Author: ![jamesobutler](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jamesobutler/32/7579_2.png) [@jamesobutler](https://discourse.vtk.org/u/jamesobutler)
#### Post date: [June 19, 2026, 11:08am UTC](https://discourse.vtk.org/t/vtk-9-6-2-msvc2022-c-20-using-issue/16466/3 "2026-06-19T11:08:53Z")

</div>

> [@vtk 9.6.2 build error](https://discourse.vtk.org/t/vtk-9-6-2-build-error/16461/4):
>
> Build with -DCMAKE\_GENERATOR\_TOOLSET=v142 is fine. Thank You!

@APlenkin Based on your other recent comment you mentioned you were using the v142 toolset which is MSVC from Visual Studio 2019. Are you still using that or are you now using the v143 toolset for MSVC from Visual Studio 2022?

---

<div class="post-metadata">

### Author: ![APlenkin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/aplenkin/32/10672_2.png) [@APlenkin](https://discourse.vtk.org/u/APlenkin)
#### Post date: [June 19, 2026, 12:25pm UTC](https://discourse.vtk.org/t/vtk-9-6-2-msvc2022-c-20-using-issue/16466/4 "2026-06-19T12:25:57Z")

</div>

Hello, VTK were build with v142. Now I am building my project with this VTK in different configurations. Both v142 and v143 have issue then I choose to build with c++20 standart and both are fine with c++17.
