# Errors migrating VS Solution to VTK 9.1.0 (windows)

**URL:** https://discourse.vtk.org/t/errors-migrating-vs-solution-to-vtk-9-1-0-windows/7205
**Category:** Support
**Created:** [November 17, 2021, 4:13pm UTC](https://discourse.vtk.org/t/errors-migrating-vs-solution-to-vtk-9-1-0-windows/7205 "2021-11-17T16:13:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![CharInt0](https://discourse.vtk.org/user_avatar/discourse.vtk.org/charint0/32/2983_2.png) [@CharInt0](https://discourse.vtk.org/u/CharInt0)
#### Post date: [November 17, 2021, 4:13pm UTC](https://discourse.vtk.org/t/errors-migrating-vs-solution-to-vtk-9-1-0-windows/7205/1 "2021-11-17T16:13:46Z")

</div>

Hi all,  
I downloaded and successfully built VTK 9.1.0 on Windows 10. Then I tried to update a working Win C++ Visual Studio 2019 .dll project which links to the older vtk 9.0.3.  
I had a few compilation problems:

1. “…Common\Core\vtkWin32Header.h(31,10): fatal error C1083: Cannot open include file: ‘vtkConfigure.h’: No such file or directory” Actually there is not anymore a file vtkConfigure.h in vtk 9.1.0 but I could find this (deprecated?) file: Common\Core\vtkConfigureDeprecated.h. I somewhat fixed this compile problem reusing the vtkConfigure.h from vtk 9.0.3 but I doubt that this is correct.
2. After that, I faced another compile error: “…\IO\Image\vtkPNGWriter.h(29,10): fatal error C1083: Cannot open include file: ‘vtkIOImageModule.h’: No such file or directory” I had this problem also while compiling the vtk 9.0.3 and I solved it by copying the file vtkIOImageModule.h to an include directory.

I also get this new linking error for each obj in my project:  
“error LNK2001: unresolved external symbol “protected: virtual void \_\_cdecl vtkObjectBase::CollectRevisions(class std::basic\_ostream\<char,struct std::char\_traits \> &)” (?CollectRevisions@vtkObjectBase@@MEAAXAEAV?$basic\_ostream@DU?$char\_traits@D@std@@@std@@@Z)”  
I don’t know how to fix this because my project already links to vtkCommonCore-9.1.lib from lib\Release which, in my understanding, should contains the vtkObjectBase class implementation.  
Could someone shed some light on these errors? Thanks!

EDIT: I checked the vtkObjectBase.h header file and I can see the CollectRevisions declaration:

```auto
#ifndef VTK_LEGACY_REMOVE
  virtual void CollectRevisions(ostream&) {} // Legacy; do not use!
#endif

```

So perhaps should I build the vtk with the VTK\_LEGACY\_REMOVE define (in CMake?) in order to avoid the linker to look for the function definition? (I’ve built the vtk running CMake with the default settings to generate the VS Solution and then I built the solution which should be the correct way to build vtk from source on Windows)

---

<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: [November 17, 2021, 8:00pm UTC](https://discourse.vtk.org/t/errors-migrating-vs-solution-to-vtk-9-1-0-windows/7205/2 "2021-11-17T20:00:36Z")

</div>

> [@CharInt0](#):
>
> “…Common\Core\vtkWin32Header.h(31,10): fatal error C1083: Cannot open include file: ‘vtkConfigure.h’: No such file or directory” Actually there is not anymore a file vtkConfigure.h in vtk 9.1.0 but I could find this (deprecated?) file: Common\Core\vtkConfigureDeprecated.h. I somewhat fixed this compile problem reusing the vtkConfigure.h from vtk 9.0.3 but I doubt that this is correct.

`vtkWin32Header.h` now includes `vtkBuild.h`, not `vtkConfigure.h` [even on 9.1.0](https://gitlab.kitware.com/vtk/vtk/-/blob/v9.1.0/Common/Core/vtkWin32Header.h#L31). I suspect you have a stale `vtkWin32Header.h` being found somewhere.

> [@CharInt0](#):
>
> After that, I faced another compile error: “…\IO\Image\vtkPNGWriter.h(29,10): fatal error C1083: Cannot open include file: ‘vtkIOImageModule.h’: No such file or directory” I had this problem also while compiling the vtk 9.0.3 and I solved it by copying the file vtkIOImageModule.h to an include directory.

This is odd. It should be installed just fine. Where did you find the `vtkIOImageModule.h` header that you copied elsewhere?

> [@CharInt0](#):
>
> I also get this new linking error for each obj in my project:  
> “error LNK2001: unresolved external symbol “protected: virtual void \_\_cdecl vtkObjectBase::CollectRevisions(class std::basic\_ostream\<char,struct std::char\_traits \> &)” (?CollectRevisions@vtkObjectBase@@MEAAXAEAV?$basic\_ostream@DU?$char\_traits@D@std@@@std@@@Z)”

I don’t see a declaration of that method in 9.1.0…so I think you’re getting the wrong headers.

---

<div class="post-metadata">

### Author: ![CharInt0](https://discourse.vtk.org/user_avatar/discourse.vtk.org/charint0/32/2983_2.png) [@CharInt0](https://discourse.vtk.org/u/CharInt0)
#### Post date: [November 18, 2021, 7:40am UTC](https://discourse.vtk.org/t/errors-migrating-vs-solution-to-vtk-9-1-0-windows/7205/3 "2021-11-18T07:40:49Z")

</div>

Hi Ben,  
Thank you very much, you are right: my project was still including the old headers. I don’t know how it happened, I suspect I simply made the mistake of working too late when I am tired. Shame on me. This morning I built vtk 9.1.0 again and copied the headers and It worked fine. I got an error because my code was calling a deprecated function:  
error C4996: ‘vtkThreshold::ThresholdBetween’: Use ‘SetLowerThreshold’, ‘SetUpperThreshold’ and ‘SetThresholdFunction’ instead.  
I fixed it and because yesterday I did not get this error, this is another proof that I was compiling the wrong headers.  
Sorry for the mistake and thanks again
