Please Help I am stuck
Hello,
when compiling this file Iam getting the compiler error c2011 error C2011: ''GPSprite'' : ''class'' type redefinition...
I cant figure out whats the problem
Heres the code :
Header:
#include <ddraw.h>
#include "Variables.h"
class GPSprite
{
public:
GPSprite(int x, int y,int width,int height, int type);
GPSprite();
bool GPSSetAnim(int index, int duration = -1);
...
-SNIP-
...
int sequencearray[10];
protected:
int xpos , ypos,breite,hoehe;
int type;
bool loaded;
bool movement;
bool visible;
...
-SNIP-
...
private:
};
And here the source file:
#include <windows.h> // include important windows stuff
SOME MORE HERE..
#include <ddraw.h>
#include "Graphics.h"
#include "GPSprite.h"
#include "Variables.h"
#include "debug.h"
extern char buffer[80];
extern HWND main_window_handle;
GPSprite::GPSprite(int x, int y, int width, int height, int itype )
{
xpos = x;
ypos = y;
breite= width;
hoehe = height;
type = itype;
SetBounds();
active = false;
movement = false;
visible = true;
animstate = SPRITE_ANIM_STATE_RUNNING;
loaded = false;
framepointer = 0;
sequencepointer = 0;
velocity = 10;
runtype = SPRITE_ANIMATE_LOOP;
for(int i=0;i<10;i++)
sequencearray = -1;
}
GPSprite::GPSprite()
{
xpos = 0;
ypos = 0;
breite= 100;
hoehe = 100;
type = SPRITE_SINGLE_FRAME;
SetBounds();
active = false;
movement = false;
visible = true;
loaded = false;
}
... -SNIP- ... Some functions here ...
I really have no clue , please help,
using visual studio .net
thanks in advance
amigo
Looks like you''re including the header file that defines GPSprite more than once somewhere; maybe Variables.h includes it?
The easy answer is to try putting #pragma once at the top of every header file; that way, each will only get included once, and will be ignored if you try and include it a second time somewhere.
HTH...
www.coldcity.com
code, pics, life
The easy answer is to try putting #pragma once at the top of every header file; that way, each will only get included once, and will be ignored if you try and include it a second time somewhere.
HTH...
www.coldcity.com
code, pics, life
You could check for a definition and bypass the whole header if it's already defined. If it's not defined, define it and then proceed to the rest of the header file as follows
[edited by - JimboC on October 21, 2002 10:48:25 AM]
#include <d3d8.h>#ifndef C_HEADER_FILE#define C_HEADER_FILEclass CClassDefinition{public: // public stuff hereprivate: // private stuff here};#endif
[edited by - JimboC on October 21, 2002 10:48:25 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement