3.6.1 does not compile on gcc 3.3

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
spasmous
Posts: 31
Joined: Mon, 2009-02-02, 19:19

3.6.1 does not compile on gcc 3.3

#1 Post by spasmous »

DCMTK 3.6.0 configures and compiles without any problem on gcc 3.3. However, I took the snapshot of 3.6.1 (dcmtk-3.6.1_20120515) and it configures but does not compile. I was wondering if there was some key new compiler feature needed for 3.6.1... My C++ is not good enough to know or if there may be a bug.

Code: Select all

g++     -DHAVE_CONFIG_H -DDCMTK_BUILD_DATE=\"2012-05-15\" -DUSE_NULL_SAFE_OFSTRING  -DNDEBUG  -c -I. -I. -I../include -I../../config/include -I../include -I../../ofstd/include -I../../oflog/include  \
 -O -I/usr/include/libxml2 -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L -Wall  telemlen.cc
telemlen.cc: In member function `virtual void 
   OFTestdcmdata_elementLength_pixelItem::run()':
telemlen.cc:103: error: syntax error before `,' token
telemlen.cc:104: error: invalid initialization of non-const reference of type '
   DcmElement&' from a temporary of type 'DcmPixelItem (*)(...)'
telemlen.cc:40: error: in passing argument 1 of `void 
   testElementLengthForElem(DcmElement&, const char*, long int)'
telemlen.cc: In member function `virtual void 
   OFTestdcmdata_elementLength_pixelSequence::run()':
telemlen.cc:110: error: syntax error before `,' token
telemlen.cc:111: error: invalid initialization of non-const reference of type '
   DcmElement&' from a temporary of type 'DcmPixelSequence (*)(...)'
telemlen.cc:40: error: in passing argument 1 of `void 
   testElementLengthForElem(DcmElement&, const char*, long int)'
make[2]: *** [telemlen.o] Error 1
make[2]: Leaving directory `/home/spas/recon/dcmtk-3.6.1_20120515/dcmdata/tests'
make[1]: *** [tests-all] Error 2
make[1]: Leaving directory `/home/spas/recon/dcmtk-3.6.1_20120515/dcmdata'
make: *** [dcmdata-all] Error 2
The offending lines (103-4) in ./dcmdata/tests/telemlen.cc are on the 5th-6th lines below:

Code: Select all

OFTEST(dcmdata_elementLength_pixelItem)
{
    // EVR_pixelItem only makes sense for class DcmPixelItem.
    // In fact, it enforces that VR in the constructor.
    DcmPixelItem pi(DcmTag(DCM_PatientName, DcmVR(EVR_pixelItem)));
    testElementLengthForElem(pi, "PixelItem", 8);
}

J. Riesmeier
DCMTK Developer
Posts: 2505
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: 3.6.1 does not compile on gcc 3.3

#2 Post by J. Riesmeier »

Does it work when you apply the following patch?

Code: Select all

diff --git a/dcmdata/tests/telemlen.cc b/dcmdata/tests/telemlen.cc
index d30dcb7..3724057 100644
--- a/dcmdata/tests/telemlen.cc
+++ b/dcmdata/tests/telemlen.cc
@@ -1,6 +1,6 @@
 /*
  *
- *  Copyright (C) 2011, OFFIS e.V.
+ *  Copyright (C) 2011-2012, OFFIS e.V.
  *  All rights reserved.  See COPYRIGHT file for details.
  *
  *  This software and supporting documentation were developed by
@@ -93,14 +93,16 @@ OFTEST(dcmdata_elementLength_pixelItem)
 {
     // EVR_pixelItem only makes sense for class DcmPixelItem.
     // In fact, it enforces that VR in the constructor.
-    DcmPixelItem pi(DcmTag(DCM_PatientName, DcmVR(EVR_pixelItem)));
+    const DcmTag tag(DCM_PatientName, DcmVR(EVR_pixelItem));
+    DcmPixelItem pi(tag);
     testElementLengthForElem(pi, "PixelItem", 8);
 }

 OFTEST(dcmdata_elementLength_pixelSequence)
 {
     // DcmPixelSequence forces EVR_OB, no point in trying other VRs.
-    DcmPixelSequence ps(DcmTag(DCM_PatientName, DcmVR(EVR_OB)));
+    const DcmTag tag(DCM_PatientName, DcmVR(EVR_OB));
+    DcmPixelSequence ps(tag);
     testElementLengthForElem(ps, "PixelSeq", 20);
 }

spasmous
Posts: 31
Joined: Mon, 2009-02-02, 19:19

Re: 3.6.1 does not compile on gcc 3.3

#3 Post by spasmous »

J. Riesmeier wrote:Does it work when you apply the following patch?
Yes. Amazing, thanks again for your help J. Riesmeier!

J. Riesmeier
DCMTK Developer
Posts: 2505
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: 3.6.1 does not compile on gcc 3.3

#4 Post by J. Riesmeier »

Thanks again for your report (and your feedback). The fix has just been committed to the git repository.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest