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

Stephen Thomas stephenthomas1 at boisestate.edu
Thu Nov 3 15:19:03 EDT 2016

Hi Dan,

Thanks for the quick response.

Yes, you are right, I used the command "make -j8 install" to copy the
header files to the /usr/local/include/vtk-6.3/". But I pointed to the
build folder for the libraries.

How do I uninstall the system VTK? I have also tried to install vtk 6 and
vtk 5 using the "sudo apt-get install libvtk6-dev" and "sudo apt-get
install libvtk5-dev".

Thank you,
Stephen Thomas.

On Thu, Nov 3, 2016 at 1:13 PM, Dan Lipsa <dan.lipsa at kitware.com> wrote:

> Stephen,
> It seems that you are reading libraries from your own
> VTK: -L/home/sthomas/projects/VTK-build/lib
> but the headers are from the system installed
> VTK: /usr/local/include/vtk-6.3/
> I suggest uninstalling the system VTK or make sure that the correct
> headers are picked up by LAMMPS.
> On Thu, Nov 3, 2016 at 2:47 PM, Stephen Thomas <
> stephenthomas1 at boisestate.edu> wrote:
>> 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<vtkXMLPPolyDa
>> taWriter>::New()':
>> /usr/local/include/vtk-6.3/vtkSmartPointer.h:117: undefined reference to
>> `vtkXMLPPolyDataWriter::New()'
>> dump_custom_vtk.o: In function `vtkSmartPointer<vtkXMLPUnstru
>> cturedGridWriter>::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.
>> _______________________________________________
>> Powered by www.kitware.com
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161103/4fa2784c/attachment.html>

More information about the vtkusers mailing list