error: forward declare in xcode

cryingraven

Registered
I downloaded an SDK a while back, extracted the files, opened the xcode project file and hit the build button and it compiled with no problems of any kind...on Panther.

Now, a couple of months later, I have installed Tiger and am trying to compile the exact same code, extracted from the same archive from the same CD I put it on back then.

Now for some reason I get 20 errors. In fact it is only 10 pairs of errors:
Invalid use of stuct with unknown type
followed by
Error: forward declare of class ResManager

I then proceed to comment out all lines that actually call the object but leave the declaration intact. It then compiles without that problem, but then gives me loads of other errors in another file. I assume that if I comment out all the error giving commands that it will give me errors in other files since the actual error that are reported are 4 errors per line and the stuff it mentions doesn't even exist in the line.

Stuff like:
ThisResource = Offset(resourcelist,sizeof(resource));
gives an error along the lines of:
Error: -> cannot appear in constant expression
Error: & cannot appear in constant expression
Error: enumerator value for <something> not integer constant

I assume that the Offset function contains all these problems.

Anyway, the code was the first code I ever compiled out of the box and now it gives me loads of errors. Why? What makes tiger's xcode so differnt from panther's xcode and how do I fix it?

Some further info:

In my .h file:

class ResManger;

extern ResManger *ResourceManager;

void someClass::function1()
{
ResourceManager->somefunction();
}

class Resmanager()
{
...
};

In my .cpp file:
ResManager *ResourceManager;

The line ResourceManager->somefunction();
causes the error messages relating to the forward declaration.
 
Tiger uses by default GCC 4, while Panther uses GCC 3.3. GCC 4 is a lot stricter. You can set it up to use GCC 3.3 by selecting your target and go Get Info. Then in the Rules tab, click the + button at the bottom, and choose for "Process" the "C++ Sources Files" and for "using" choose "GCC 3.3".
 
do you have any idea what i went through to get this to work???

Heck I even used my panther restore discs to downgrade back to 10.3.3 and then system update to 10.3.9. Only to have most of my apps completely fail to run...among them of course was xcode. So I had to upgrade to Tiger again and face the same old compilation errors again.

Instead all I had to do was double click my target and change one drop down list value before hitting build! Wow! What would I have done without you?!?!

Question: I thought updates are supposed to make stuff better. Isn't forward declarations a rather important feature of coding? Why does GCC4 have problems with this???

Or, more accurately, using an extern variable of a type that has been declared forward...

Anyway, Now I have my old friends the ranlib errors which took me 2 weeks to get solved and now fixed in only 2 minutes. Lovely.

Now why in the world is there suddenly an error:
undefined symbols _fprintf$LDBLStud

Seems the quest continues....sheesh! So close and yet so far!
 
Back
Top