When I run my program in debug mode with VTK version 9.2, I get the following error :
In function `vtkGenericDataArray<vtkAOSDataArrayTemplate<long long>, long long>::SetValue(long long, long long)':
userPath/vtk-9.2/vtkGenericDataArray.h:122: undefined reference to `vtkAOSDataArrayTemplate<long long>::SetValue(long long, long long)'
In function `vtkGenericDataArray<vtkAOSDataArrayTemplate<int>, int>::SetValue(long long, int)':
userPath/vtk-9.2/vtkGenericDataArray.h:122: undefined reference to `vtkAOSDataArrayTemplate<int>::SetValue(long long, int)'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [userPath\build.make:1215: userPath/file.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:4642: userPath/all] Error 2
mingw32-make: *** [Makefile:110: all] Error 2
Error Level is 2
Has anyone come across this kind of error before? And if so, do you have a solution?
Thank you for reading,
Guilhem.
if (CMAKE_BUILD_TYPE MATCHES Release)
target_compile_options(proj_name BEFORE PRIVATE -O3)
else()
target_compile_options(proj_name BEFORE PRIVATE -O3)
endif()
To my CMakeLists and it worked !
Thank you for the help David
In other words, you enable optimization so that the inline methods of vtkAOSDataArrayTemplate and vtkSOADataArrayTemplate are fully inlined during compilation of your project. Hence, the compiler doesn’t generate symbol lookups for these methods. Kinda tricky, but it’s nice to have a solution.