DCMTK on Mac OS X anyone?

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
xargon
Posts: 15
Joined: Mon, 2007-04-30, 13:16

DCMTK on Mac OS X anyone?

#1 Post by xargon »

Hi everyone,

I have a project that works well on windows and linux and uses VTK along
with DCMTK. I recently tried to port in to OS X and get the following errors
from the DCMTK files. DCMTK had compiled and installed fine.

My includes look as follows:

Code: Select all

#ifdef _WIN32
    #include "dcmtk/config/cfwin32.h"
#else
    #include "dcmtk/config/cfunix.h"
#endif

#include "dcmtk/config/osconfig.h"
#include "dcmtk/ofstd/oftypes.h"
#include "dcmtk/dcmdata/dctk.h"

During compilation, I am getting the following error:

Code: Select all

/usr/local/dicom/include/dcmtk/dcmdata/dcobject.h:251: error: expected
unqualified-id before 'do'
/usr/local/dicom/include/dcmtk/dcmdata/dcobject.h:251: error: expected
unqualified-id before 'while'
/usr/local/dicom/include/dcmtk/dcmdata/dcbytstr.h:198: error: expected
unqualified-id before 'do'
/usr/local/dicom/include/dcmtk/dcmdata/dcbytstr.h:198: error: expected
unqualified-id before 'while'
/usr/local/dicom/include/dcmtk/dcmdata/dcitem.h:208: error: expected
unqualified-id before 'do'
/usr/local/dicom/include/dcmtk/dcmdata/dcitem.h:208: error: expected
unqualified-id before 'while'

I checked these header files and it is always this declaration:

Code: Select all

virtual OFCondition verify(const OFBool autocorrect = OFFalse );
I was wondering if anyone else has come across this problem and can offer some insight on how to solve it.

Many thanks.

Cheers,

Anja

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi Anja,

please include the file "dcmtk/config/osconfig.h" first in every file of your sources. This encapsulates most system dependencies - you won't neet the #ifdef construct posted above. I hope this solves your problem.

Regards,
Michael

xargon
Posts: 15
Joined: Mon, 2007-04-30, 13:16

#3 Post by xargon »

Thanks! I will try it today!

xargon
Posts: 15
Joined: Mon, 2007-04-30, 13:16

Moe strange problems

#4 Post by xargon »

Hello,

I modified the include as you said, so now it looks as following:

Code: Select all

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dcfilefo.h"
#include "dcmtk/dcmdata/dcdatset.h"
#include "dcmtk/ofstd/oftypes.h"
This again works on windows with no problems (I have not tried it on Linux yet, but hopefully it will work as well). However, on OS X I got the following error first:

Code: Select all

#error DCMTK needs stringstream or strstream type
So, I included the <sstream> header. However, that did not change anything.

Now, I get the following new errors:

Code: Select all

/usr/local/dicom/include/dcmtk/ofstd/oflist.h:58:2: error: #error Your C++ compiler cannot handle class templates:
/usr/local/dicom/include/dcmtk/ofstd/oflist.h:498:2: error: #error Your C++ Compiler is not capable of compiling this code
/usr/local/dicom/include/dcmtk/dcmdata/dcobject.h:251: error: expected unqualified-id before 'do'
/usr/local/dicom/include/dcmtk/dcmdata/dcobject.h:251: error: expected unqualified-id before 'while'
/usr/local/dicom/include/dcmtk/dcmdata/dcbytstr.h:198: error: expected unqualified-id before 'do'
/usr/local/dicom/include/dcmtk/dcmdata/dcbytstr.h:198: error: expected unqualified-id before 'while'
/usr/local/dicom/include/dcmtk/dcmdata/dcitem.h:208: error: expected unqualified-id before 'do'
/usr/local/dicom/include/dcmtk/dcmdata/dcitem.h:208: error: expected unqualified-id before 'while'
/usr/local/dicom/include/dcmtk/dcmdata/dcsequen.h:187: error: expected unqualified-id before 'do'
/usr/local/dicom/include/dcmtk/dcmdata/dcsequen.h:187: error: expected unqualified-id before 'while'
I outputted the version of my gcc compiler and it looks as follows:

Code: Select all

i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367)
Any insights? Do I have to put osconfig as the first include in ALL my files or only the ones that include other DCMTK headers?

Thanks,
Anja

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#5 Post by Jörg Riesmeier »

Did you define HAVE_CONFIG_H in your Makefile? See dcmtk/config/Makefile.def ...

xargon
Posts: 15
Joined: Mon, 2007-04-30, 13:16

#6 Post by xargon »

Hello,

Checked under the Makefile.def and found the following line:

GLOBALDEFS = -DHAVE_CONFIG_H

Cheers,
Anja

Per
Posts: 99
Joined: Mon, 2007-09-03, 10:53
Location: Trondheim, Norway
Contact:

#7 Post by Per »

I've been bitten by this silliness under MacOSX, too, and my solution was to add a

Code: Select all

#undef verify
after including the MacOSX system headers, or at the top of the source file when using Xcode, since Xcode seems to do some magic header inclusion that makes life difficult. Hope this helps.

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#8 Post by Michael Onken »

Hi Per,

Do you like to share your ready-to-build Xcode DCMTK project? We could add it to the contributions section of the DCMTK site :)

Regards,
Michael

Per
Posts: 99
Joined: Mon, 2007-09-03, 10:53
Location: Trondheim, Norway
Contact:

#9 Post by Per »

Sorry, I may have been unclear. I have not made an Xcode project for DCMTK, I just used the DCMTK library in an Xcode project.

kikoalbiol
Posts: 1
Joined: Mon, 2011-01-17, 16:57

#10 Post by kikoalbiol »

The hint has been very useful.

I have compiled with Xcode the library. It can be used as a OSX Framework.

It's compiled in x86_84 and i386 and is included in a small scu dicom retrive server.

How can I add this project 3.6.0 to contribution section?

Michael Onken wrote:Hi Per,

Do you like to share your ready-to-build Xcode DCMTK project? We could add it to the contributions section of the DCMTK site :)


Regards,
Michael

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#11 Post by Michael Onken »

Hi kikoalbiol,

thanks for wanting to contribute your efforts with the DCMTK community! I'm happy that you were successful in working with DCMTK.

if you like, send us your code to dicom/at/offis/dot/de . However, we usually only include it if it works cross-platform and "fits well" with the rest of DCMTK. Of course we can address some smaller issues ourselves but will not be able to work much on your contribution.

If it will _not_ be integrated into DCMTK, we might add it to a section with 3rd-party contributions.

Best regards and thanks,
Michael

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest