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

Abayiz abayiz at yahoo.com
Sun Nov 20 13:20:01 EST 2011


Hello Cagatay,


Thank you very much for your answer.

I am using ITK4, so tried as you said, changing the link libraries line in CMake. But it didn't work, still giving the same error.
And, I've defined "SetThirdAdvectionFunction" in "VavBoneSegmentationLevelSetImageFilter.h" clearly, I am sure this is not the error point. 


Are there any other suggestions? 


Thanks,
Abayiz



________________________________
 From: David Doria <daviddoria at gmail.com>
To: akbarjan bayiz <abayiz at yahoo.com> 
Sent: Sunday, November 20, 2011 7:57 PM
Subject: Fwd: [Insight-users] Cmake Linking Object Error: undefined reference
 
This was sent to the list:

David




---------- Forwarded message ----------
From: cagatay bilgin <bilgincc at gmail.com>
Date: Sat, Nov 19, 2011 at 10:59 PM
Subject: Re: [Insight-users] Cmake Linking Object Error: undefined reference
To: Abayiz <abayiz at yahoo.com>
Cc: "insight-users at itk.org" <insight-users at itk.org>


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
>


_____________________________________
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/20111120/8b654181/attachment.htm>


More information about the Insight-users mailing list