Re: compile error while switching from gcc 3.3 to 4.0
Re: compile error while switching from gcc 3.3 to 4.0
- Subject: Re: compile error while switching from gcc 3.3 to 4.0
- From: Andreas Grosam <email@hidden>
- Date: Fri, 9 Sep 2005 01:42:00 +0200
On 08.09.2005, at 21:38, Matei Stroila wrote:
I am trying to compile with gcc 4.0 the same code that did not have any problems with 3.3 (not even serious warnings).
I get a lot of errors like this:
<x-tad-smaller>./Particles/ParticleStuffParameters.h:442: error: invalid use of undefined type 'struct ParticleStuff'</x-tad-smaller>
<x-tad-smaller>./Particles/ParticleStuffParameters.h:18: error: forward declaration of 'struct ParticleStuff'</x-tad-smaller>
The code has circular dependencies so it has forward declarations like:
You should avoid situations where a header file A.h includes a header B.h, which in turn includes another one C.h which in turn requires all declarations from header A.h. If you have properly guarded the header files, header A.h will not be included (recursively) in C.h again. But the required declarations may still not be included at the top level, so you get errors.
The only solution: restructure your source files!
class ParticleStuff;
shouldn't you declare "struct" instead of "class"?
I searched the internet a lot for a hint, but could not get one.
I use Xcode 2.1
gcc-3 was a bit strange when you declared a class as a friend in another class. The friend class has been automatically declared - if it was not declared or defined previously.
Now, in gcc-4 a friend declaration requires that the class has been declared previously (standard) - means, before you can use a class in a friend declarartion, you need to define it or declare it.
Not sure if this helps at all, but may be this is a hint.
Regards
Andreas
Thanks for help,
Matei
_______________________________________________
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
_______________________________________________
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