[Insight-users] Problem with ITK and GDCM in the same program

edoardo.belletti at alice.it edoardo.belletti at alice.it
Wed May 12 13:41:15 EDT 2010


Hi everyone,
I have a problem: I have created the program that I attached you that use both ITK and GDCM libraries.
when i run it without the comments on this lines (49-53):
	ImageIOType::Pointer dicomIO = ImageIOType::New();
	ReaderType::Pointer reader = ReaderType::New();
	reader->SetFileName( argv[1] );
	reader->SetImageIO( dicomIO );
	reader->Update();

the output is:

edoardo at edoardo-laptop:~/ITK/Tesi/01_Autocrop/crop/bin$ make
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

instead of if these lines are commented I don't have any error; but my problem is that I want to use also ITK libraries into my project.

I attached you also my CMakeList.txt

moreover my cmake configurations are these:

CMAKE_AR                         /usr/bin/ar                                                                                                           
 CMAKE_BUILD_TYPE                                                                                                                                       
 CMAKE_COLOR_MAKEFILE             ON                                                                                                                    
 CMAKE_CXX_COMPILER               /usr/bin/c++                                                                                                          
 CMAKE_CXX_FLAGS                                                                                                                                        
 CMAKE_CXX_FLAGS_DEBUG            -g                                                                                                                    
 CMAKE_CXX_FLAGS_MINSIZEREL       -Os -DNDEBUG                                                                                                          
 CMAKE_CXX_FLAGS_RELEASE          -O3 -DNDEBUG                                                                                                          
 CMAKE_CXX_FLAGS_RELWITHDEBINFO   -O2 -g                                                                                                                
 CMAKE_C_COMPILER                 /usr/bin/gcc                                                                                                          
 CMAKE_C_FLAGS                                                                                                                                          
 CMAKE_C_FLAGS_DEBUG              -g                                                                                                                    
 CMAKE_C_FLAGS_MINSIZEREL         -Os -DNDEBUG                                                                                                          
 CMAKE_C_FLAGS_RELEASE            -O3 -DNDEBUG                                                                                                          
 CMAKE_C_FLAGS_RELWITHDEBINFO     -O2 -g                                                                                                                
 CMAKE_EXE_LINKER_FLAGS                                                                                                                                 
 CMAKE_EXE_LINKER_FLAGS_DEBUG                                                                                                                           
CMAKE_EXE_LINKER_FLAGS_MINSIZE                                                                                                                         
 CMAKE_EXE_LINKER_FLAGS_RELEASE                                                                                                                         
 CMAKE_EXE_LINKER_FLAGS_RELWITH                                                                                                                         
 CMAKE_INSTALL_PREFIX             /usr/local                                                                                                            
 CMAKE_LINKER                     /usr/bin/ld                                                                                                           
 CMAKE_MAKE_PROGRAM               /usr/bin/make                                                                                                         
 CMAKE_MODULE_LINKER_FLAGS                                                                                                                              
 CMAKE_MODULE_LINKER_FLAGS_DEBU                                                                                                                         
 CMAKE_MODULE_LINKER_FLAGS_MINS                                                                                                                         
 CMAKE_MODULE_LINKER_FLAGS_RELE                                                                                                                         
 CMAKE_MODULE_LINKER_FLAGS_RELW                                                                                                                         
 CMAKE_NM                         /usr/bin/nm                                                                                                           
 CMAKE_OBJCOPY                    /usr/bin/objcopy                                                                                                      
 CMAKE_OBJDUMP                    /usr/bin/objdump                                                                                                      
 CMAKE_RANLIB                     /usr/bin/ranlib                                                                                                       
 CMAKE_SHARED_LINKER_FLAGS                                                                                                                              
 CMAKE_SHARED_LINKER_FLAGS_DEBU         
 CMAKE_SHARED_LINKER_FLAGS_MINS                                                                                                                         
 CMAKE_SHARED_LINKER_FLAGS_RELE                                                                                                                         
 CMAKE_SHARED_LINKER_FLAGS_RELW                                                                                                                         
 CMAKE_SKIP_RPATH                 OFF                                                                                                                   
 CMAKE_STRIP                      /usr/bin/strip                                                                                                        
 CMAKE_USE_RELATIVE_PATHS         OFF                                                                                                                   
 CMAKE_VERBOSE_MAKEFILE           OFF                                                                                                                   
 GDCM_DIR                         /usr/local/lib/gdcm-2.0                                                                                               
 ITK_DIR                          /usr/local/lib/InsightToolkit    


and my ITK_USE_SYSTEM_GDCM is ON 
and my GDCM_USE_ITK is OFF

Please I need help, I very don't know which is the problem.

Thank you very much for your interest
Best regards 
Edoardo


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100512/46e4af36/attachment-0001.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100512/46e4af36/attachment-0001.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cropping.cxx
Type: text/x-c++src
Size: 4893 bytes
Desc: cropping.cxx
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100512/46e4af36/attachment-0001.cxx>


More information about the Insight-users mailing list