# Linker error while building application with VTK component

**URL:** https://discourse.vtk.org/t/linker-error-while-building-application-with-vtk-component/4957
**Category:** Support
**Created:** [January 5, 2021, 4:24pm UTC](https://discourse.vtk.org/t/linker-error-while-building-application-with-vtk-component/4957 "2021-01-05T16:24:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Olumide](https://discourse.vtk.org/user_avatar/discourse.vtk.org/olumide/32/2810_2.png) [@Olumide](https://discourse.vtk.org/u/Olumide)
#### Post date: [January 5, 2021, 4:24pm UTC](https://discourse.vtk.org/t/linker-error-while-building-application-with-vtk-component/4957/1 "2021-01-05T16:24:38Z")

</div>

I am trying to build an application, called [niftysim](https://sourceforge.net/projects/niftysim/), which has optional visualization component that relies on VTK dependency. niftysim builds okay but when I enable the visualization component, in CMAKE, as shown below

USE\_VIZ ON  
VTK\_DIR /home/Olumide/Downloads/src/VTK/build

I get the following linker error:

```
CMakeFiles/niftysim.dir/niftysim.cpp.o: In function `tledGenericVTKMeshSource<tledSurface, vtkPolyData>::Update()':
/home/Olumide/Downloads/src/NiftySim-253/source/tledGenericVTKMeshSource.tpp:32: undefined reference to `vtkPolyData::Allocate(long long, int)'
/home/Olumide/Downloads/src/NiftySim-253/source/tledGenericVTKMeshSource.tpp:44: undefined reference to `vtkPolyData::InsertNextCell(int, int, long long*)'
CMakeFiles/niftysim.dir/niftysim.cpp.o: In function `tledGenericVTKMeshSource<tledMesh, vtkUnstructuredGrid>::_AddVTKNodeAttribute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float const*, int)':
/home/Olumide/Downloads/src/NiftySim-253/source/tledGenericVTKMeshSource.tpp:76: undefined reference to `vtkAOSDataArrayTemplate<float>::InsertNextTupleValue(float const*)'
/home/Olumide/Downloads/src/NiftySim-253/source/tledGenericVTKMeshSource.tpp:79: undefined reference to `vtkAOSDataArrayTemplate<float>::InsertNextTupleValue(float const*)'
CMakeFiles/niftysim.dir/niftysim.cpp.o: In function `tledGenericVTKMeshSource<tledSurface, vtkPolyData>::_AddVTKNodeAttribute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float const*, int)':
/home/Olumide/Downloads/src/NiftySim-253/source/tledGenericVTKMeshSource.tpp:76: undefined reference to `vtkAOSDataArrayTemplate<float>::InsertNextTupleValue(float const*)'
/home/Olumide/Downloads/src/NiftySim-253/source/tledGenericVTKMeshSource.tpp:79: undefined reference to `vtkAOSDataArrayTemplate<float>::InsertNextTupleValue(float const*)'
libviz.a(tledKeyPressInteractorStyle.cpp.o):(.data.rel.ro._ZTV27tledKeyPressInteractorStyle[_ZTV27tledKeyPressInteractorStyle]+0x178): undefined reference to `vtkInteractorObserver::PickersModified()'

```

I have built VTK-8.0.0 (to VTK\_DIR) and have verified that the undefined references are present in libvtkCommonDataModel-8.0.a and libvtkCommonCore-8.0.a, so I am at loss as to the cause of this error.

When I run `make VERBOSE=1` I get

```
cd /home/Olumide/Downloads/src/NiftySim-253/cpu_build/source && /opt/cmake-3.19.1-Linux-x86_64/bin/cmake -E cmake_link_script CMakeFiles/niftysim.dir/link.txt --verbose=1
/usr/bin/c++ -I/home/Olumide/Downloads/src/VTK-8.0.0/build/install/include/vtk-8.0 -D_Visualisation_ -D_USE_BOOST_ -D_CMAKE_USED -g -L/home/Olumide/Downloads/src/VTK-8.0.0/build/install/lib -lvtkCommonDataModel-8.0 -lvtkCommonCore-8.0 -rdynamic -Wl,--no-as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs CMakeFiles/niftysim.dir/niftysim.cpp.o -o niftysim -Wl,-rpath,/home/Olumide/Downloads/src/VTK/build/lib: libtled.a libviz.a ../xmlParser/libxmlParser.a -lboost_system -lboost_thread -lboost_date_time -lboost_chrono -lboost_atomic ... /home/Olumide/Downloads/src/VTK/build/lib/libvtkCommonDataModel-9.0.so.9.0.0 ... /home/Olumide/Downloads/src/VTK/build/lib/libvtkCommonCore-9.0.so.9.0.0
-ldl -lpthread -lgomp -lpthread

```

As you can see, I have **also** added linker options that specify the libraries containing the missing symbols, i.e.  
`-L/home/Olumide/Downloads/src/VTK-8.0.0/build/install/lib -lvtkCommonDataModel-8.0 -lvtkCommonCore-8.0`

Unfortunately, this doesn’t do the trick either.

---

<div class="post-metadata">

### Author: ![Olumide](https://discourse.vtk.org/user_avatar/discourse.vtk.org/olumide/32/2810_2.png) [@Olumide](https://discourse.vtk.org/u/Olumide)
#### Post date: [January 5, 2021, 11:17pm UTC](https://discourse.vtk.org/t/linker-error-while-building-application-with-vtk-component/4957/2 "2021-01-05T23:17:25Z")

</div>

Problem solved.

Alas it was a path mixup.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [January 7, 2021, 1:48am UTC](https://discourse.vtk.org/t/linker-error-while-building-application-with-vtk-component/4957/3 "2021-01-07T01:48:39Z")

</div>

Reviving long-dead toolkits is usually not worth the effort. Niftysim was a one-man-project and probably there are good reasons why nobody joined the project or continued it once its author moved on.

I would recommend to try simulation tools that are actively maintained and developed, such as FeBIO, SOFA, or IMSTK.

---

<div class="post-metadata">

### Author: ![Olumide](https://discourse.vtk.org/user_avatar/discourse.vtk.org/olumide/32/2810_2.png) [@Olumide](https://discourse.vtk.org/u/Olumide)
#### Post date: [January 7, 2021, 2:45am UTC](https://discourse.vtk.org/t/linker-error-while-building-application-with-vtk-component/4957/4 "2021-01-07T02:45:24Z")

</div>

SOFA was my initial choice but unfortunately it is poorly documented.

niftysim is lightweight and better documented. I’ve been in touch with its primary developer, who promises to revive the project, so for now it is a better choice.
