[vtkusers] Undefined reference error while compiling with VTK shared libraries in Ubuntu 16.04

Stephen Thomas stephenthomas1 at boisestate.edu
Thu Nov 3 14:47:44 EDT 2016


Hi,

I am trying to build a C++ code called LAMMPS which uses VTK for writing
vtk files. I am getting errors that seem like linking errors. I am able to
compile VTK successfully, but when I compile the LAMMPS code, I get the
following errors from the line
vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<
vtkXMLPolyDataWriter>::New();
:

mpicxx -g -O  -L/home/sthomas/projects/VTK-build/lib   dump_custom_vtk.o
..........................................  -lvtkCommonCore-6.3
-lvtkIOCore-6.3 -lvtkIOXML-6.3 -lvtkIOLegacy-6.3 -lvtkCommonDataModel-6.3
-lblas -llapack   -o ../lmp_mpi
dump_custom_vtk.o: In function `vtkSmartPointer<
vtkXMLPPolyDataWriter>::New()':
/usr/local/include/vtk-6.3/vtkSmartPointer.h:117: undefined reference to
`vtkXMLPPolyDataWriter::New()'
dump_custom_vtk.o: In function `vtkSmartPointer<
vtkXMLPUnstructuredGridWriter>::New()':
/usr/local/include/vtk-6.3/vtkSmartPointer.h:117: undefined reference to `
vtkXMLPUnstructuredGridWriter::New()'
collect2: error: ld returned 1 exit status

This is the first time I am writing to this forum. I may be missing some
supporting information. Please let me know if more information is required.

I must also point out that I have another code installed on the machine
which has also installed VTK 7.0 and its shared libraries. I am not sure if
these are somehow interfering. I am assuming that the -L/path_to_lib as
seen above should take care of pointing to the right libraries.

Thank you,
Stephen Thomas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161103/3a5a4590/attachment.html>


More information about the vtkusers mailing list