Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explicitly instantiate VTK class template to work-around error.
When trying to build ElmerGUI with VTK and MATC on Windows, linking fails with the following errors: ``` C:\WINDOWS\system32\cmd.exe /C "cd . && C:\msys64\mingw64\bin\c++.exe -g -mwindows @CMakeFiles\ElmerGUI.rsp -o ElmerGUI\Application\ElmerGUI.exe -Wl,--out-implib,ElmerGUI\Application\libElmerGUI.dll.a -Wl,--major-image-version,0,--minor-image-version,0 && cd ." C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ElmerGUI/Application/CMakeFiles/ElmerGUI.dir/vtkpost/vtkpost.cpp.obj: in function `VtkPost::ReadVtuFile(QString)': D:/repo/elmerfem/ElmerGUI/Application/vtkpost/vtkpost.cpp:1350:(.text$_ZN7VtkPost11ReadVtuFileE7QString+0xfbf): undefined reference to `vtkAOSDataArrayTemplate<int>::GetValue(long long) const' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/repo/elmerfem/ElmerGUI/Application/vtkpost/vtkpost.cpp:1365:(.text$_ZN7VtkPost11ReadVtuFileE7QString+0x1125): undefined reference to `vtkAOSDataArrayTemplate<int>::GetValue(long long) const' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/repo/elmerfem/ElmerGUI/Application/vtkpost/vtkpost.cpp:1393:(.text$_ZN7VtkPost11ReadVtuFileE7QString+0x13dd): undefined reference to `vtkAOSDataArrayTemplate<double>::GetValue(long long) const' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/repo/elmerfem/ElmerGUI/Application/vtkpost/vtkpost.cpp:1401:(.text$_ZN7VtkPost11ReadVtuFileE7QString+0x1480): undefined reference to `vtkAOSDataArrayTemplate<double>::GetValue(long long) const' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/repo/elmerfem/ElmerGUI/Application/vtkpost/vtkpost.cpp:1401:(.text$_ZN7VtkPost11ReadVtuFileE7QString+0x14ad): undefined reference to `vtkAOSDataArrayTemplate<double>::GetValue(long long) const' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ElmerGUI/Application/CMakeFiles/ElmerGUI.dir/vtkpost/matc.cpp.obj: in function `Matc::grad(VtkPost*, double*, double*)': D:/repo/elmerfem/ElmerGUI/Application/vtkpost/matc.cpp:111:(.text$_ZN4Matc4gradEP7VtkPostPdS2_+0xc5): undefined reference to `vtkAOSDataArrayTemplate<float>::SetValue(long long, float)' ``` It looks like the corresponding template class instantiations aren't correctly exported from the VTK DLLs on Windows. See also: https://gitlab.kitware.com/vtk/vtk/-/issues/18444 Work around that issue by explicitly instantiating the class template with the respective types.
- Loading branch information