I wanted to build VTK.sln but I got the following errors:
@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.
In the Project’s Settings, add
/FORCE:MULTIPLEto 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.
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:
-DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2:STRING="YES" -DVTK_MODULE_ENABLE_VTK_ViewsQt:STRING="YES" -DVTK_MODULE_ENABLE_VTK_GUISupportQt:STRING="YES" -DVTK_MODULE_ENABLE_VTK_RenderingQt:STRING="YES" -DQt6_DIR:PATH="PATH_TO_QT/6.6.0/msvc2019_64/lib/cmake/Qt6" -DVTK_MODULE_ENABLE_VTK_RenderingOpenXR:STRING="YES" -DOpenXR_INCLUDE_DIR:PATH="PATH_TO_OPENXR/include/openxr" -DOpenXR_LIBRARY:FILEPATH="PATH_TO_OPENXR/x64/lib/openxr_loader.lib" -DVTK_MODULE_ENABLE_VTK_RenderingOpenVR:STRING="YES" -DOpenVR_LIBRARY:FILEPATH="PATH_TO_OPENVR/lib/win64/openvr_api.lib" -DOpenVR_INCLUDE_DIR:PATH="PATH_TO_OPENVR/headers"
(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.