Re: bringing windows c++ code to Macintosh
Re: bringing windows c++ code to Macintosh
- Subject: Re: bringing windows c++ code to Macintosh
- From: M Pulis <email@hidden>
- Date: Wed, 10 Sep 2008 00:25:24 -0700
On Sep 9, 2008, at 11:49 PM, Michael Williamson wrote: Not sure about (1). (2) This struct appears to be a class, Xcode objects to "public:" of course, as it is not declared as a class. How should this be declared on Xcode? (extra credit - how did the microsoft compiler pass this?)
structs are almost the same as classes in C++. The main (I think only?) difference is that members are public by default in structs, whereas they're private by default in classes. So the "public" modifier in your struct is redundant in this case (assuming you have no "private" or "protected" specifier prior to it). If you remove it everything should behave the same and maybe XCode won't complain. Although redundant, I thought it's still allowed by standard C++ so that might be why it works with other compilers.
No prior private or protected specifiers. Removed public: now the error is "error: field 'ReadFromStr' declared as a function" as I would expect, not knowing that structs can have functions (thats what I thought differentiated a struct from a class).
(3) Last (at the moment), Xcode objects (pun intended) to this class.
class McsFile : public CFile {
Complains how? What is the error?
the error is "error: syntax error before 'McsFile'
Also, removing ": public CFile" yields the same error.
If it's complaining about CFile, I have a feeling that's a class from a Microsoft SDK, so it's not surprising it's not found on Mac.
In case it is important, these declarations come from an ".hpp" source file, which Xcode should understand.
Gary
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden