[Insight-users] Cmake Linking Object Error: undefined reference

cagatay bilgin bilgincc at gmail.com
Sat Nov 19 22:59:25 EST 2011


First, if you are using ITK4, try changing your link
libraries line in cmake with this one
target_link_libraries(Slicer ${ITK_LIBRARIES})
I remember that being a problem sometimes.

Basically the linker cannot find the function
SetThirdAdvectionFunction. Where is it defined ?
Do you have SetThirdAdvectionFunction function
implemented in VavBoneSegmentationLevelSetImageFilter.cxx?
Do you have it declared in your VavBoneSegmentationLevelSetImageFilter.h
file ?

Regards,
Cagatay

On Fri, Nov 18, 2011 at 3:44 AM, Abayiz <abayiz at yahoo.com> wrote:

> Hi all,
>
> I am using ccmake to compile my itk code. But the compilation problem
> occurs while building a specific target for object file. Here is the error
> message from the screen:
>
> *******************Scanning dependencies of target VavSegment
> [100%] Building CXX object CMakeFiles/VavSegment.dir/VavSegment.o
> Linking CXX executable VavSegment
> CMakeFiles/VavSegment.dir/VavSegment.o:(.rodata._ZTVN3itk38VavBoneSegmentationLevelSetImageFilterINS_5ImageIfLj3EEES2_fEE[vtable
> for itk::VavBoneSegmentationLevelSetImageFilter<itk::Image<float, 3u>,
> itk::Image<float, 3u>, float>]+0x458): undefined reference to
> `itk::VavBoneSegmentationLevelSetImageFilter<itk::Image<float, 3u>,
> itk::Image<float, 3u>,
> float>::SetThirdAdvectionFunction(itk::Image<itk::FixedArray<float, 3u>,
> 3u>*)'
> collect2: ld returned 1 exit status
> make[2]: *** [VavSegment] Error 1
> make[1]: *** [CMakeFiles/VavSegment.dir/all] Error 2
> make: *** [all] Error 2
> ********************
>
> My CMakeLists is as follows:
>
> ****************
> cmake_minimum_required(VERSION 2.4)
>
> PROJECT( VavSegment )
>
> FIND_PACKAGE(ITK)
>   IF(ITK_FOUND)
>     INCLUDE(${ITK_USE_FILE})
> ENDIF(ITK_FOUND)
>
> SET(CMAKE_BUILD_TYPE "Release")
>
> ADD_EXECUTABLE( VavSegment VavSegment.cxx
> VavBoneSegmentationLevelSetFunction.h
> VavBoneSegmentationLevelSetFunction.txx
> VavBoneSegmentationLevelSetImageFilter.h
> VavBoneSegmentationLevelSetImageFilter.txx
>  )
>
> TARGET_LINK_LIBRARIES( VavSegment
>                ITKIO ITKCommon ITKBasicFilters ITKStatistics ITKAlgorithms
>             )
> ***************************
>
>  What could be the problem? Many thanks in advance!
> Regards,
> Abayiz
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111119/7b99675a/attachment.htm>


More information about the Insight-users mailing list