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

Bill Lorensen bill.lorensen at gmail.com
Sun Nov 20 14:01:35 EST 2011


Try this:
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)

TARGET_LINK_LIBRARIES( VavSegment
              ${ITK_LIBRARIES}
            )

On Fri, Nov 18, 2011 at 6: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
>
>



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the Insight-users mailing list