[SDL] Silly c++ question

Ricardo Cruz rpmcruz at clix.pt
Wed Aug 16 11:10:27 PDT 2006


Em Quarta, 16 de Agosto de 2006 17:44, o Oleg Katsitadze escreveu:
> On Wed, Aug 16, 2006 at 08:50:43AM -0700, darkplastic wrote:
> > struct Animation_Object
> > {
>
> [...]
>
> > struct Collison_Object
> > {
> > 	Animation_Object _animation_Object;
>
> "Animation_Object" is not a type.  The full type name is
> "struct Animation_Object".  (At least this is so in C, must
> be the same in C++.)  Therefore, the last quoted line must
> be
>
>  	struct Animation_Object _animation_Object;
>
> Or else, to avoid "struct", try typedef'ing "struct
> _Animation_Object" to "Animation_Object":
>
> typedef struct _Animation_Object {
>   /* Contents of Animation_Object struct. */
> } Animation_Object;
>
> And make sure GFX.h is included in Game.h.
>
 No, his code was correct, though I believe yours is valid C++ as well for 
compatibility reasons. Types and structures are not in different namespaces 
in C++, since it already adds a real namespace framework.

Cheers,
 Ricardo

> HTH,
> Oleg
>
-- 
Two wrongs don't make a right, but three lefts do.




More information about the SDL mailing list