I have MSYS2 installed on my Windows 10 box. I’ve installed vtk via pacman with mingw-w64-x86_64-vtk; this is vtk 9.2.2. I’m using gcc 12.2 and is the only version of gcc that I currently have available in the MSYS2 install.
The code that I’m trying to build works fine on Linux with vtk 9.1 and gcc 4.8.5
For which I see the following error:
D:/msys64/home/roger/GitRepos/CCCCC/Code/sssIntersectionPolyDataCheck.cxx:338: undefined reference to `vtkAOSDataArrayTemplate::GetValue(long long) const’
Can anyone offer a suggestion on how to fix this?
Because I didn’t build vtk here and only have the install via pacman, I suspect that I can’t alter the vtk source for this.
I also compile VTK with MSYS2 and I had to tweak the source code a bit.
Find the entire definition of the offending symbol, which is located inside the definition of the vtkAOSDataArrayTemplate class that looks like this (this example applies to the GetTypedTuple() method that errored with me):
I apologize for taking so long to get back on this.
I didn’t use your approach because I was using the pre-built Vtk module for MSYS2 and installed with pacman.
What I discovered in the mean time is that my error occurs if I set -g or -O0 on the compiler flags. If I set -O1, -O2, or -O3, I compile my code just fine and don’t see the problem.
To me, this does appear as a compiler bug (or what ever one wants to call it). At least I have something that works.
Yes, unfortunately often you can’t enable optimization falgs for the debug version for numerous reasons. And, yes, it is likely a lurking bug in MinGW64 triggered by the way it preprocesses templates, which is not yet full C++11 compliant. Personally, I don’t like mixing template definitions and their implementations in the headers, but the way the VTK developers did is not illegal and is supposed to be supported.