[Insight-users] Error in compilation of WatershedImageFilter in a standalone project

Luis Ibanez luis . ibanez at kitware . com
Wed, 17 Sep 2003 16:02:51 -0400


Hi Feng,

The problem may be related to the order in which you specify your 
libraries to CMake.

You are doing:

LINK_LIBRARIES (
 ITKAlgorithms
 ITKBasicFilters
 ITKCommon
 ITKIO
 ITKNumerics
 ITKWrapLib
)

With your Wrapped library at the end.  You should try:

LINK_LIBRARIES ( 
 ITKWrapLib
 ITKAlgorithms
 ITKBasicFilters
 ITKCommon
 ITKIO
 ITKNumerics
)

with the Wrapped library at the beginning, since your library depend on
ITK libraries.  The order of libraries in the link line is relevant on Unix.

Try this and compare the Makefile generated from both options. In 
particular
look for the position of WrapLib with respect to ITKAlgorithms.a



Regards,


   Luis


-------------------
Feng Ma wrote:

> Hi, Luis:
>
>  This is an interesting situation.
>
>  I did the following test: copy over 
> itkWatershedMiniPipelineProgressCommand.h  and cxx files into my 
> wrapper directory. Build the ITKWrapLab  library. Now libITKWrapLab.a 
> also has itkWatershedMiniPipelineProgressCommand.o
>
>  Then I do make. Everything is fine.
>
>  So it is true that itkWatershedMiniPipelineProgressCommand.o is not 
> properly linked to my project. How does that happen? This is the link 
> line from Makefile generated:
>
>    c++        -ftemplate-depth-50 -fPIC  $(fmatest_SRC_OBJS)   -o 
> ./fmatest -rdynamic -L/r2/fma/ITK/lib/InsightToolkit -L. -lITKCommon 
> -lITKIO -lITKNumerics -lITKAlgorithms -lITKBasicFilters -lITKWrapLib 
> -litkpng -litkzlib -lITKMetaIO -lITKDICOMParser -lITKEXPAT -lITKVHDIO 
> -lITKNumerics -lITKCommon -litkvnl_algo -litkvnl -litknetlib -lm 
> -litksys -lpthread -ldl -lm -Wl,-rpath,/r2/fma/ITK/lib/InsightToolkit:.
>
>
>  This is the contents of the two libraries (ITKWrapLab and ITKAlgorithms)
>
>    fma at ws-fma:/r2net/r2/fma/ITK/lib/InsightToolkit 260 % ar tf 
> libITKWrapLib.a
>    itkWatershed3DSeg.o
>    itkWatershedMiniPipelineProgressCommand.o
>
>    fma at ws-fma:/r2net/r2/fma/ITK/lib/InsightToolkit 261 % ar tf 
> libITKAlgorithms.a
>    itkWatershedMiniPipelineProgressCommand.o
>    itkBioGene.o
>    itkBioGeneNetwork.o
>
>  The question is that both libraries are in the same search path. 
> However, one is linked and other is not linked.
>
>  Any clue?
>
>  Thanks a lot.
>
> -Feng
>
> _________________________________________________________________
> Get a FREE computer virus scan online from McAfee. 
> http://clinic . mcafee . com/clinic/ibuy/campaign . asp?cid=3963
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>