[Insight-users] I: [Gdcm2] Problem with ITK and GDCM in the same program
Luis Ibanez
luis.ibanez at kitware.com
Mon May 24 16:49:18 EDT 2010
Hi Eduardo,
You probably should be configuring ITK with the following
CMake flag ON:
ITK_USE_SYSTEM_GDCM
And then pointing ITK to the binary directory where you
build your own GDCM library.
In this way you will avoid to have the duplicate symbols
that result from mixing an external GDCM library with the
one that we carry in Insight/Utilities/gdcm
Regards,
Luis
-------------------------------------------------------------------
On Mon, May 17, 2010 at 1:46 PM, <edoardo.belletti at alice.it> wrote:
> Hi, thank you very much for your interest.
> I can't use the first way because I need to extract
> SequenceOfUltrasoundRegion from the header dicom, which are tags that I
> can't extract using the embedded gdcm libraries in itk.
> The second way it is not very clear for me. First of all I use Linux and not
> Windows, and after that I don't know how can I link ITK and GDCM libraries
> without cmake.
>
> But my problem is that I have a multiple definition of
> `gdcm::Global::~Global() indeed my output is:
> edoardo at edoardo-laptop:~/ITK/Tesi/01_Autocrop/crop/bin$ make
> -- Configuring done
> -- Generating done
> -- Build files have been written to:
> /home/edoardo/ITK/Tesi/01_Autocrop/crop/bin
> Scanning dependencies of target cropping
> [100%] Building CXX object CMakeFiles/cropping.dir/cropping.cxx.o
> Linking CXX executable cropping
> /usr/local/lib/InsightToolkit/libitkgdcm.a(gdcmGlobal.o): In function
> `gdcm::Global::Global()':
> gdcmGlobal.cxx:(.text+0x0): multiple definition of `gdcm::Global::Global()'
> /usr/local/lib/libgdcmDICT.a(gdcmGlobal.cxx.o):gdcmGlobal.cxx:(.text+0x0):
> first defined here
> /usr/local/lib/InsightToolkit/libitkgdcm.a(gdcmGlobal.o): In function
> `gdcm::Global::Global()':
> gdcmGlobal.cxx:(.text+0x300): multiple definition of
> `gdcm::Global::Global()'
> /usr/local/lib/libgdcmDICT.a(gdcmGlobal.cxx.o):gdcmGlobal.cxx:(.text+0x80):
> first defined here
> /usr/local/lib/InsightToolkit/libitkgdcm.a(gdcmGlobal.o): In function
> `gdcm::Global::~Global()':
> gdcmGlobal.cxx:(.text+0x600): multiple definition of
> `gdcm::Global::~Global()'
> /usr/local/lib/libgdcmDICT.a(gdcmGlobal.cxx.o):gdcmGlobal.cxx:(.text+0x100):
> first defined here
> /usr/local/lib/InsightToolkit/libitkgdcm.a(gdcmGlobal.o): In function
> `gdcm::Global::~Global()':
> gdcmGlobal.cxx:(.text+0x694): multiple definition of
> `gdcm::Global::~Global()'
> /usr/local/lib/libgdcmDICT.a(gdcmGlobal.cxx.o):gdcmGlobal.cxx:(.text+0x14c):
> first defined here
> collect2: ld returned 1 exit status
> make[2]: *** [cropping] Errore 1
> make[1]: *** [CMakeFiles/cropping.dir/all] Errore 2
> make: *** [all] Errore 2
>
> Please I need help because I have to join all my works with this piece of
> code that use gdcm library.
> Thank you very much for interest
>
> Edoardo
>
>
> -----Messaggio originale-----
> Da: Mark Roden [mailto:mmroden at gmail.com]
> Inviato: gio 13/05/2010 16.05
> A: edoardo.belletti at alice.it
> Cc: GDCM-developers
> Oggetto: Re: [Gdcm2] Problem with ITK and GDCM in the same program
>
> Hi Eduardo,
>
> There are two ways I use to get itk and gdcm to play nice with each other.
>
> One, you can use the embedded gdcm libraries in itk. I've attached a
> class of my own that I use for reading CT image slices. This class is
> an adaptations of the example code in the itk instructions; I wrote
> the class because I found myself reading CT images quite a bit.
> Hopefully, it'll be helpful to you.
>
> The CMaskLists.txt for including the class is pretty straightforward:
>
> ADD_EXECUTABLE(myproject myproject.cxx CTSeriesReader.h
> CTSeriesReader.cpp itkInclude.h)
> TARGET_LINK_LIBRARIES(myproject ITKCommon ITKIO ITKIOReview)
>
> That compiles and works for me.
>
> The other approach is to use the itk flat directory install CMake
> option in ITK. Once you install ITK and gdcm (and it can't be to the
> default C:\program files directory on windows 7, as that's now a
> protected directory), you can then link to those include directories
> from your own project, and build without using cmake. This approach
> is more involved, but allows you to debug into the libraries much more
> easily than the CMake version (at least, that's been my experience in
> visual studio 2008). If you don't do a flat install, you'll find
> yourself tracing a very large include tree to get everything that's
> necessary to just read in a file.
>
> I hope that this helps, and please let me know if you need more,
>
> Mark
>
>
>
>
>
>
> _____________________________________
> 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
>
>
More information about the Insight-users
mailing list