# Building VTK git 5a0129e461 with MingW64 9.5.0 GCC

**URL:** https://discourse.vtk.org/t/building-vtk-git-5a0129e461-with-mingw64-9-5-0-gcc/15127
**Category:** Support
**Created:** [January 9, 2025, 3:26am UTC](https://discourse.vtk.org/t/building-vtk-git-5a0129e461-with-mingw64-9-5-0-gcc/15127 "2025-01-09T03:26:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![biggestsonicfan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/biggestsonicfan/32/9694_2.png) [@biggestsonicfan](https://discourse.vtk.org/u/biggestsonicfan)
#### Post date: [January 9, 2025, 3:26am UTC](https://discourse.vtk.org/t/building-vtk-git-5a0129e461-with-mingw64-9-5-0-gcc/15127/1 "2025-01-09T03:26:07Z")

</div>

Greetings all.

I have read in quite a few places that VTK has troubles under MingW and MSYS and have attempted as many workarounds as I can (eg `CMAKE_CXX_FLAGS` of `-Wa,-mbig-obj` for `File too big` errors and `-O1` optimization with `release` build to work around _some_ `undefined reference` [errors](https://discourse.vtk.org/t/undefined-reference-to-vtkaosdataarraytemplate/9643/4)). However, there is one `undefined reference` error I can’t seem to get past:

```auto
FAILED: bin/libvtkCommonDataModel-9.4.dll lib/libvtkCommonDataModel-9.4.dll.a
C:\windows\system32\cmd.exe /C "cd . && C:\gcc-9.5.0\mingw64\bin\c++.exe -mwin32 -mthreads -O3 -DNDEBUG -mthreads -shared -o bin\libvtkCommonDataModel-9.4.dll -Wl,--out-implib,lib\libvtkCommonDataModel-9.4.dll.a -Wl,--major-image-version,9,--minor-image-version,4 @CMakeFiles\CommonDataModel.rsp && cd ."
c:/gcc-9.5.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.5.0/../../../../x86_64-w64-mingw32/bin/ld.exe: Common/DataModel/CMakeFiles/CommonDataModel.dir/vtkBoundingBox.cxx.obj:vtkBoundingBox:(.text+0xa85b): undefined reference to vtkImplicitArray<vtkStructuredPointBackend<double> >::GetTypedTuple(long long, double*) const'
c:/gcc-9.5.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.5.0/../../../../x86_64-w64-mingw32/bin/ld.exe: Common/DataModel/CMakeFiles/CommonDataModel.dir/vtkBoundingBox.cxx.obj:vtkBoundingBox:(.text+0xbd0b): undefined reference to vtkImplicitArray<vtkStructuredPointBackend<double> >::GetTypedTuple(long long, double*) const'
c:/gcc-9.5.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.5.0/../../../../x86_64-w64-mingw32/bin/ld.exe: Common/DataModel/CMakeFiles/CommonDataModel.dir/vtkBoundingBox.cxx.obj:vtkBoundingBox:(.text+0xd1bb): undefined reference to vtkImplicitArray<vtkStructuredPointBackend<double> >::GetTypedTuple(long long, double*) const'
collect2.exe: error: ld returned 1 exit status

```

Cmake [config](https://pastebin.com/KRPvnv2Z) and [gen](https://pastebin.com/XLw53zGA) logs. Full make [log](https://pastebin.com/w6dnDbdV). Full cmake\_install.cmake file [here](https://pastebin.com/zYvWUZeW).  
Build setup:  
winlibs\_mingw’s GCC 9.5.0 + MinGW-w64 10.0.0 MSVCRT (release 1)  
Chocolatey’s GNU make 4.4.1  
Windows cmake 3.31.3  
VTK cloned from kitware’s gitlab at commit hash 5a0129e46105c83d7c33bb65a3daa6506bb2cf59 (2 commits behind master as of this post).

For debugging purposes, `make` has been run with `VERBOSE=1` and the `CMAKE_VERBOSE_MAKEFILE` has been set to `ON` in the cmake config.

---

<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 10, 2025, 2:34pm UTC](https://discourse.vtk.org/t/building-vtk-git-5a0129e461-with-mingw64-9-5-0-gcc/15127/2 "2025-01-10T14:34:58Z")

</div>

The vtkImplicitArray was added in VTK 9.3. These “undefined reference” errors occur because MinGW does explicit template instantiations differently from MSVC or gcc/linux. I’m fairly sure that these templates can be made to work with MinGW, but I don’t know exactly what changes are needed.

---

<div class="post-metadata">

### Author: ![biggestsonicfan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/biggestsonicfan/32/9694_2.png) [@biggestsonicfan](https://discourse.vtk.org/u/biggestsonicfan)
#### Post date: [January 10, 2025, 9:23pm UTC](https://discourse.vtk.org/t/building-vtk-git-5a0129e461-with-mingw64-9-5-0-gcc/15127/3 "2025-01-10T21:23:12Z")

</div>

Thank you! That is a very straightforward answer. As it was more of an experiment than a necessity, I will look into building VTK 9.2.

---

<div class="post-metadata">

### Author: ![Joaquin\_Opazo](https://discourse.vtk.org/user_avatar/discourse.vtk.org/joaquin_opazo/32/10239_2.png) [@Joaquin\_Opazo](https://discourse.vtk.org/u/Joaquin_Opazo)
#### Post date: [September 5, 2025, 9:36am UTC](https://discourse.vtk.org/t/building-vtk-git-5a0129e461-with-mingw64-9-5-0-gcc/15127/4 "2025-09-05T09:36:56Z")

</div>

Hi!,

I just wanna ask if you build VTK 9.2 or you find a patch to the problem. I have exactly the same problem and its been days trying to build VTK 9.5.

Thanks for your time 🙂

Best,

JO
