1

I use dcmtk-3.6.0 to handle DICOM images, and use the log4cplus-1.1.2 as the logging library. The g++ compiler complained for the redefined error, because dcmtk-3.6.0 also used log4cplus with previous version as logging library.

/usr/local/log4cplus-1.1.2/include/log4cplus/layout.h:72:28: error: redefinition of ‘class log4cplus::Layout’
/usr/include/dcmtk/oflog/layout.h:50:28: error: previous definition of ‘class   log4cplus::Layout’
/usr/local/log4cplus-1.1.2/include/log4cplus/layout.h:103:28: error: redefinition of ‘class log4cplus::SimpleLayout’
/usr/include/dcmtk/oflog/layout.h:80:28: error: previous definition of ‘class log4cplus::SimpleLayout’
/usr/local/log4cplus-1.1.2/include/log4cplus/layout.h:158:28: error: redefinition of ‘class log4cplus::TTCCLayout’

Is there any way to solve this problem?

sfzhang
  • 669
  • 9
  • 18
  • I guess you will have to use the one shipped with DCMTK. – wilx Aug 28 '14 at 06:15
  • May I replace the namespace `log4cplus` in log4cplus-1.1.2 with a different one, and rebuild it again? – sfzhang Aug 28 '14 at 10:31
  • I guess it is possible. It is however not supported/made easy in any way. – wilx Aug 28 '14 at 10:43
  • Yes, it is not a good idea to replacing all namespace `log4cplus` in log4cplus-1.1.2. However, the log4cplus version in dcmtk-3.6.0 is too old. – sfzhang Aug 28 '14 at 10:50
  • Hmm, you might try setting up something like `-Dlog4cplus=mylog4cplus` on compiler command line to get this done without actually touching the source itself. – wilx Aug 28 '14 at 10:52

1 Answers1

0

Thanks the DCMTK developer, J. Riesmeier's posted the answer:

The current DCMTK snapshot should solve this issue because it contains the following commit: http://git.dcmtk.org/web?p=dcmtk.git;a=commit;h=e39d1907dd53ad4a16e9aa9e2d86faa84f96ce2e

See also http://forum.dcmtk.org/viewtopic.php?t=4078

sfzhang
  • 669
  • 9
  • 18