[vtkusers] undefined reference errors when compiling

Yichuan GU guyichuan at gmail.com
Tue Mar 6 21:58:47 EST 2012


Thanks for reponding.

Yes, I think there is ${VTK_LIBRARIES} in the CMakeLists.txt Here is the
part withs VTK in the CMakeLists.txt file :

 OPTION(WITH_VTK "Set to OFF to build without VTK" ON )
>
> IF (WITH_VTK)
>
>   FIND_PACKAGE(VTK REQUIRED)
>
>   IF (VTK_FOUND)
>
>     INCLUDE (${VTK_USE_FILE})
>
>  SET(VTK_LIBRARIES vtkRendering vtkCommon)
>
>   ENDIF (VTK_FOUND)
>
> ENDIF (WITH_VTK)
>
>
and

IF (WITH_PETSC)
>
>  SET(LIBS
>
>      ${VTK_LIBRARIES}
>
>      scopi blas lapack cblas slu voro++
>
>      ${PETSC_LIBRARIES} ${FFTW_LIBRARIES} StokesPartLib
>
>  )
>
> ELSE ()
>
>  SET(LIBS
>
>      ${VTK_LIBRARIES}
>
>      scopi blas lapack cblas slu voro++
>
>  )
>
> ENDIF (WITH_PETSC)
>
>

On Tue, Mar 6, 2012 at 9:56 PM, John Drescher <drescherjm at gmail.com> wrote:

> On Tue, Mar 6, 2012 at 3:52 PM, Yichuan GU <guyichuan at gmail.com> wrote:
> > Hello,
> >
> > I'm new to vtk. Actually i try to compile a particle modeling software
> > written by our professor with vtk components and i met several undefined
> > reference errors:
> >
> >>> Linking CXX executable bin/gmc.out
> >>>
> >>> lib/libscopi.a(Out_VTK.o): In function `Out_VTK::plot(int)':
> >>>
> >>> Out_VTK.cpp:(.text+0x98c): undefined reference to
> >>> `vtkPolyDataMapper::New()'
> >>>
> >>> Out_VTK.cpp:(.text+0x9c6): undefined reference to `vtkLODActor::New()'
> >>>
> > How can i fix this problem ? Thanks a lot !!
> >
>
> Make sure you have ${VTK_LIBRARIES} in your target_link_libraries for
> your target in your CMakeLists.txt file for your project.
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120307/c420cf03/attachment.htm>


More information about the vtkusers mailing list