I've been working on a project for a while now and everything's been working fine until I added one last class, at which point I started to get the following errors:
--------------------Configuration: TestingGrounds - Win32 Debug--------------------
Compiling...
Base.cpp
c:\c++\tester\testinggrounds\base.h(58) : error C2143: syntax error : missing ';' before '*'
c:\c++\tester\testinggrounds\base.h(58) : error C2501: 'Polygon' : missing storage-class or type specifiers
c:\c++\tester\testinggrounds\base.h(58) : error C2501: 'Poly' : missing storage-class or type specifiers
c:\c++\tester\testinggrounds\base.cpp(181) : error C2065: 'Poly' : undeclared identifier
c:\c++\tester\testinggrounds\base.cpp(192) : error C2541: delete : cannot delete objects that are not pointers
Testground.cpp
c:\c++\tester\testinggrounds\base.h(58) : error C2143: syntax error : missing ';' before '*'
c:\c++\tester\testinggrounds\base.h(58) : error C2501: 'Polygon' : missing storage-class or type specifiers
c:\c++\tester\testinggrounds\base.h(58) : error C2501: 'Poly' : missing storage-class or type specifiers
Error executing cl.exe.
TestingGrounds.exe - 8 error(s), 0 warning(s)
----------------------
I'm using msvc++ 6 and here is the code:
It's the beginning of what will (hopefully) be a 3d-engine. It's not very functional yet, though. I left out some stuff in the code that I think is irrelevant. Especially since commenting all references to "Polygon" objects in "Actor" makes the project compilable and functional (except that I don't get any polys...)Code://base.h #ifndef BASE_H #define BASE_H #include "math2.h" /////////////FACE////////////////////////////////// typedef struct tagFACE //The face of a poly { VERTEX *Vertex; //List of verts for storing position VERTEX Normal; //For setting up lights GLfloat tX,tY; //Tex-coords }FACE; //////////////POLYGON CLASS//////////////////////////// /////////////////////////////////////////////////////// class Polygon { private: int NumFaces; //The number of faces the poly consist of FACE *Faces; //The faces int NumVertices; //Number of "total" vertices, ie verts with same coordinates don't count more than once VERTEX *SharedVert; //The shared vertices VERTEX Facing; //Vertex describing what direction the poly is facing public: //Constructors Polygon(); Polygon(int nF,int nV,VERTEX f); //Destructor ~Polygon(); //Methods, self-explanatory int GetNumFaces(); //Gets the number of faces VERTEX GetFacing(); //Gets the direction the poly is facing VERTEX *GetVertices();//Returns an array containing all the shared vertices void CreateSharedVert(VERTEX v);//Create one shared vert void CreateSetofSharedVerts(int,VERTEX *v);//Create int nr of shared verts *v bool ModSharedVert(int which,VERTEX v);//Modify which vert to be v bool SetFace(int which,GLfloat x,GLfloat y, int numverts,int *whichverts,VERTEX norm);//Modify face which. Must send an int array containing info on which verts it will use and in what order void CreateFace(GLfloat x,GLfloat y,int nv,int *wv,VERTEX norm);//Creates a new face }; ////////////////////BASE ACTOR CLASS///////////////////////// ///////////////////////////////////////////////////////////// class Actor { private: int PolyCount; //The number of polys Polygon *Poly; //A dynamic array of the polys that is the actor VERTEX Facing; //A vertex describing the direction the actor is facing VERTEX PointOfMass;//Where the actors point of mass is located public: Actor(); //Standard constructor ~Actor(); //Standard destructor int GetPolyCount();//Returns the amount of polys VECTOR GetFacing();//Returns the facing VERTEX GetMPoint();//Returns the actor's point of mass }; #endif //base.cpp - for readability, excluded what I think is working stuff #include "base.h" Actor::~Actor() { if(Poly) { delete [] Poly; Poly=NULL; } }
I've scoured the net and a host of programming forums for a working solution to this, and I've tried to double-check every single little piece of code, but can't find anything... I'll be very thankful for any help.
Thanks in advance!



LinkBack URL
About LinkBacks


