Class predefinition errors in Xcode 3.1!!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2008 at 16:29, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R11
Platform: Mac OSX ;
Language(s) : C++ ;---------
I do this type of thing a bit to avoid problems with headers and class definitions (see red) :#include "d.h"
class A; // <- only pointer, we will include header in .cpp
class C
{
protected:
A * m_pA;
D m_d;
public:
C(A * );
~C();
A* GetA(){ return m_pA; }
//inline int GetAValue(){ return m_pA->GetSomeValue(); } <- we can't do that!
inline int GetDValue(){ return m_d.GetSomeValue(); }
};Xcode 3.1 keeps showing these as compiler ERRORS ( error: expected constructor, destructor, or type conversion before 'class' ). Is there something that I need to change in the project settings? This is standard practice in C++. And no problems in Windows 32 (VC++ 6.0 and VS2005), Windows 64 (VS2005), MacOS 10.4 (CodeWarrior, Xcode 2.4.1). Only showing in MacOS 10.5/Xcode 3.1. 14 out of 15 good builds say 'there is something screwy here'.
I can't figure out what's wrong here and nothing found at Apple's developer site or mail list archive.
Thanks,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2008 at 17:17, xxxxxxxx wrote:
Hi!
You use a method of a class, so xCode can't find the method. The redirection to class A at the beginning is not enough for xCode.
You have to put the hole method headers before class C. I guess, the same error, could occur for class D, too.
class A
{
public:
int getSomevalue();
}class C
{
protected:
A * m_pA;
D m_d;
public:
C(A * );
~C();
A* GetA(){ return m_pA; }
//inline int GetAValue(){ return m_pA->GetSomeValue(); }
inline int GetDValue(){ return m_d.GetSomeValue(); }
};int A::GetSomeValue{
return 4;
}Good luck. Bye..
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2008 at 19:27, xxxxxxxx wrote:
No. No I DON'T!!! In the class C definition, there is only a pointer to class A. That is all that is required then is a predefinition if including the header will cause header definition loops (which I'd like to avoid and is why I use a predefinition). Works in Visual Studio 6.0. Works in Visual Studio 2005 (32 and 64 bit). Works in CodeWarrior (8 and 9). Works in Xcode 2.4.1. And it has worked like this for three years. Sorry. I am not some newbie baby. I've been programming since 1988!!! Apple people haven't obviously...
Sorry. I am a bit p.o.d at Apple at the moment (as usual, again).
Look, here's the code:
>
//////////////////////////////////////////////////////////////// \> // Ltd_PLALoader.h \> //////////////////////////////////////////////////////////////// \> // interPoser Generic Wavefront OBJ Sequence Processor Class include \> //////////////////////////////////////////////////////////////// \> // V0.1 2008.03.21 Robert Templeton \> //////////////////////////////////////////////////////////////// \> #ifndef \_LTD_PLALOADER_H\_ \> #define \_LTD_PLALOADER_H\_ \> \> // Includes \> #include "general.h" \> #include "StringTokenizer.h" \> #include "FileReader.h" \> #include "Settings.h" \> #include "PathFinder.h" \> #include "Ltd_PoserMaterial.h" \> #include "Ltd_WavefrontObject.h" \> \> // CreateKeys(...flags) definitions \> #define CREATEKEYS_FLAGS_NONE 0 \> #define CREATEKEYS_FLAGS_SCALE (1<<0) \> #define CREATEKEYS_FLAGS_NEGATE (1<<1) \> #define CREATEKEYS_FLAGS_ANGULAR (1<<2) \> \> [RED][B]class IPPDialog; //THIS IS VALID, APPLE!!![/B][/FONT] \> \> // CLASS: Ltd_PLALoader \> // -- PLA File Processor \> class Ltd_PLALoader \> { \> private: \> BaseDocument\* activeDoc; \> BaseDocument\* mergeDoc; \> AtomArray\* atomArray; \> IPMaterial\* firstIPMaterial; \> IPMaterial\* lastIPMaterial; \> IPPDialog\* dialog; \> Settings\* settings; \> FileReader\* filereader; \> StringTokenizer\* tokenreader; \> Ltd_PoserMaterial\* firstMaterial; \> Ltd_PoserMaterial\* lastMaterial; \> Ltd_PoserMaterial\* indexMaterial; \> PathFinder pathFinder; \> Ltd_WavefrontObject wavefront; \> Real scaling; \> LONG seqWidth; \> \> // Methods \> BaseDocument\* LoadObj(const Filename& fname, Bool insert); \> BOOL LoadMtl(Filename fn); \> BOOL BeginAnim(BaseDocument\* destDoc, Filename fn, String animRoot, LONG startf, LONG endf, LONG nthf, LONG insertion, Real fps, BOOL occupyRange, BOOL backwards); \> String GetSeqExtString(LONG frame); \> #ifdef C4D_R95 \> BOOL ConvertSplineToHair(BaseDocument\* doc, SplineObject\* sobj, const Bool& animate); \> BaseObject\* FindNewObject(BaseObject\* obj); \> #endif \> void Flush(); \> BOOL GetMaterialArray(); \> void GetAllArray(BaseObject\* obj); \> void AppendSelectedArray(BaseObject\* obj); \> public: \> Ltd_PLALoader(); \> ~Ltd_PLALoader(); \> BOOL Init(IPPDialog\* t_dialog); \> Settings\* GetSettings(); \> PathFinder\* GetPathFinder(); \> BaseDocument\* GetMergeDocument(); \> Real GetScaling(); \> AtomArray\* GetAtomArray(); \> IPMaterial\* GetFirstIPMaterial(); \> IPMaterial\* GetLastIPMaterial(); \> // -- interPoser Ltd \> BOOL Load(); \> Ltd_PoserMaterial\* GetIndexMaterial(); \> void SetIndexMaterial(Ltd_PoserMaterial\* mat); \> BOOL GetSelectedArrayChildren(BaseDocument\* doc); \> BOOL GetSelectedArray(BaseDocument\* doc); \> }; \> \> #endif //\_LTD_PLALOADER_H\_ \>
Realize that the IPPDialog.h file is included in the frigging Ltd_PLALoader.cpp (where all methods are resolved in the code).
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/09/2008 at 20:21, xxxxxxxx wrote:
Just to add: I'm also getting "error: ISO C++ forbids declaration of 'xxx' with no type". And I'm certainly not alone here (along with the hundreds of others found in Google).
I love Windows. I love you, PC, even if Mac is cuter...
To be pedantic here, I simply copied the cinema4dsdk project to my plugin folder and made the relevant changes (sources and names and such). What gives on this piece o' crap called Xcode 3.1 on 10.5? I had no problems building the cinema4dsdk nor my two libs (zlib and libpng). But gosh forgive that my massive project will work within cryptic errors without obvious means to bash Xcode into compliance.
Thanks,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/09/2008 at 01:33, xxxxxxxx wrote:
Hi kuroyume0161
I had exactly the same error: ERRORS (error: expected constructor, destructor, or type conversion before 'class') in this context of a predefined class.
For a few months I asked my prof what to do , and he told me what I wrote you.
But if you are sure that my answer has nothing to do with the problem, I guess I misunderstood his answer .I thought it would be this problem - sorry. Good luck.
Bye!