Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C++ newbie questions



I'm trying to use some C++ libraries (dcmtk for reading DICOM files) in
our Objective-C/Cocoa app and, while I've got some basic C++-isms to
build and run (e.g. cout << "Hello World!" << endl;) I'm already having
trouble with some includes I need to use the actual libs. To get
"hello world" to work (I realize this doesn't exercise much C++), I
included iostream.h and gave my implementation file the .mm extension.

In Standard C++ usage, don't use #include <iostream.h>, use #include <iostream> (and similarly for all C++ system headers).

When I add the first include needed for dcmtk, the build starts failing
(see below).

Below are a list of the initial errors I'm getting. As I am a complete
C++ newbie, I'd be very grateful if anyone could give some hints as to
what is going on and how to fix it.

-----------------------

#error DCMTK needs stringstream or strstream type

(this is actually a header-generated message - I added an include for
/usr/include/gcc/darwin/3.3/c++/backward/strstream but this does not
abolish the above message. What is the correct way to include
str{ing}stream?)

#include <sstream>

------------------------

error: parse error before `:' token

(it seems to be balking at the C++ class declaration: class
OFConditionString: public OFConditionBase )

------------------------

warning: ISO C++ forbids declaration of `OFConditionString' with no type

(from these lines of code:

/// copy constructor
OFConditionString(const OFConditionString& arg)
: OFConditionBase(arg) // THIS GENERATES THE WARNING
, theCodeAndModule(arg.theCodeAndModule)
, theStatus(arg.theStatus)
, theText(arg.theText)
{
}

)

------------------------

error: only constructors take base initializers

(from this code:

/// copy constructor
OFConditionString(const OFConditionString& arg)
: OFConditionBase(arg) // THIS GENERATES THE ERROR
, theCodeAndModule(arg.theCodeAndModule)
, theStatus(arg.theStatus)
, theText(arg.theText)
{
}

)

------------------------

Sounds like it can't find the class OFConditionString, since the above is a constructor definition not a class definition.


Cheers, Glen Low


---
pixelglow software | simply brilliant stuff
www.pixelglow.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.