[SDL] Silly c++ question
Lilith Calbridge
lilith at dcccd.edu
Wed Aug 16 09:13:26 PDT 2006
Off the top of my head I'd say that your Game.h file needs to #include
"GraphicsEngine.h" . Otherwise, how does your Collision_Object struct
know what an Animation_Object is?
Lilith
>>> On 8/16/2006 at 10:50 AM, in message
<5835104.post at talk.nabble.com>,
darkplastic <darkeninghorizons at hotmail.com> wrote:
> I must be doing something really obvious wrong...and i appologise in
advance
> if i am being stupid but basically i have a struct that is part of
the gfx
> engine header file which looks like this:
>
> // watch for multiple inclusions
> #ifndef __GFX_h__
> #define __GFX_h__
>
> #include <stdlib.h>
> #include <string.h>
> #include <math.h>
> #include <vector>
> #include "Main2.h"
>
> struct Animation_Object
> {
> std::vector<SDL_Surface*> _animation;
> std::vector<int> _delays;
> int _currentAnim; //What current
animation are we playing?
> long _timeStartedPlaying; //When did animation
start playing?
> };
>
>
> and i am trying to use it in my game header file which looks like
this:
>
> // watch for multiple inclusions
> #ifndef __GAME_h__
> #define __GAME_h__
>
> #include <stdlib.h>
> #include <string.h>
> #include <math.h>
> #include <vector>
> #include "Main2.h"
>
> #define NUMBEROFMONSTERS 10
>
> struct Collison_Object
> {
> Animation_Object _animation_Object;
> SDL_Rect _coords;
> SDL_Rect _rotCoords;
> SDL_Rect _collisionArea;
> SDL_Surface *surface;
> SDL_Surface *rotSurface;
> double rotateValue;
> int alphaValue;
> int offsetx,offsety; //Offset used to find
centre of objects
> };
>
> (Note that main2.h is where everthing is being linke together):
>
> // watch for multiple inclusions
> #ifndef __Main2_h__
> #define __Main2_h__
>
> #include "SDL_mixer.h" //Used to load in music
> #include "SDL_image.h" //Used to load in non
bmp images
> #include "SDL.h"
> #include "Intro.h"
> #include "Game.h"
> #include "GraphicsEngine.h"
>
> yet when i go to compile it says:
>
> c:\documents and settings\darkplastic\desktop\!!game\game\Game.h(31)
: error
> C2146: syntax error : missing ';' before identifier
'_animation_Object'
> c:\documents and settings\darkplastic\desktop\!!game\game\Game.h(31)
: error
> C4430: missing type specifier - int assumed. Note: C++ does not
support
> default-int
> c:\documents and settings\darkplastic\desktop\!!game\game\Game.h(31)
: error
> C4430: missing type specifier - int assumed. Note: C++ does not
support
> default-int
>
> as if it cant see the Animation_object in the graphics engine header
> file....i am very confused by this :/ any suggestions? Cheers.
>
> -James
>
More information about the SDL
mailing list