This topic is now archived and is closed to further replies.


Please Help I am stuck

Recommended Posts

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

Share this post

Link to post
Share on other sites
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.

code, pics, life

Share this post

Link to post
Share on other sites
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

#include <d3d8.h>


class CClassDefinition
// public stuff here

// private stuff here



[edited by - JimboC on October 21, 2002 10:48:25 AM]

Share this post

Link to post
Share on other sites