VTK-9.3 VTK.sln build failed

I wanted to build VTK.sln but I got the following errors:

How can I fix them?

@jfausty @mwestphal These are duplicate symbol errors from the implicit array templates and vtkToImplicitRamerDouglasPeuckerStrategy - I feel like we’ve seen this before and dealt with it, but I’m not finding a reference - does this ring a bell with you?

I built from the master two days ago and it was ok.

1 Like


From c++ - error LNK2005, already defined? - Stack Overflow :

In the Project’s Settings, add /FORCE:MULTIPLE to the Linker’s Command Line options.

From MSDN: “Use /FORCE:MULTIPLE to create an output file whether or not LINK finds more than one definition for a symbol.”

Though, this is considered dirty. It’s likely a guard, anonymous namespace or extern is missing in VTK sources.

take care,


Does this occur with 9.3 RC2 ? I built that version yesterday on Visual Studio 2022 (17.8 preview 6), and didn’t see this problem. With which VS version did it happen?

Edit: I can reproduce the error with VS 2019 (16.11.30).

Correction: I see it happen on VS 2022 too; I probably just missed it before since we don’t need the FiltersReduction module.

Does this happen with the Ninja generator? We don’t test the VS generator that well for VTK.

I don´t see any issues with the Ninja or VS generator. I built from the master yesterday.

I built the VTK 9.3.0 release just now and still see this error. CMake 3.27.7 with “Visual Studio 17 2022” generator, VS 2022 17.7.6 on Windows 10 22H2; these are the options I manually set via CMake GUI:


(I haven’t tested whether any of these are strictly required for the error to happen, they are just the ones that I need to set up VTK for my needs).

EDIT: The errors only appear to happen when building Debug configuration.

EDIT2: git master builds fine.

Thanks; hopefully we can just find some commits that need backporting then.

Also, you can try building with VS’ nmake instead of a VS solution. The CMake generator for this is called “NMake Makefiles”: cmake -g "NMake Makefiles" -DCMAKE_PREFIX_PATH=... ...



EDIT: make sure to run the proper VS’ vcvarsall.bat before compiling.

I have the same link errors concerning vtkFiltersReduction when building version 9.3.0, using CMake 3.27.9 and VS2022 17.8.2. I’m building using the generated VTK.sln. The problem only occurred for me in Debug configuration, not Release configuration.