I've attached some .h and .cpp files so that you can view the code I am having trouble with.

Basically the following errors are being thrown:

Error 2 error C2059: syntax error : '{' c:\users\simon\documents\visual studio 2008\projects\objects\sprite.h 19 objects
Error 3 error C2334: unexpected token(s) preceding '{'; skipping apparent function body c:\users\simon\documents\visual studio 2008\projects\objects\sprite.h 19 objects
Error 4 error C2059: syntax error : '{' c:\users\simon\documents\visual studio 2008\projects\objects\sprite.h 23 objects
Error 5 error C2334: unexpected token(s) preceding '{'; skipping apparent function body c:\users\simon\documents\visual studio 2008\projects\objects\sprite.h 23 objects
Error 6 error C2065: 'colours' : undeclared identifier c:\users\simon\documents\visual studio 2008\projects\objects\mesh.cpp 14 objects
Error 7 error C2065: 'vertices' : undeclared identifier c:\users\simon\documents\visual studio 2008\projects\objects\mesh.cpp 15 objects
Error 8 error C2065: 'colours' : undeclared identifier c:\users\simon\documents\visual studio 2008\projects\objects\mesh.cpp 16 objects
Error 9 error C2065: 'vertices' : undeclared identifier c:\users\simon\documents\visual studio 2008\projects\objects\mesh.cpp 17 objects
Error 10 error C2065: 'colours' : undeclared identifier c:\users\simon\documents\visual studio 2008\projects\objects\mesh.cpp 18 objects
Error 11 error C2065: 'vertices' : undeclared identifier c:\users\simon\documents\visual studio 2008\projects\objects\mesh.cpp 19 objects
Error 12 error C2065: 'colours' : undeclared identifier c:\users\simon\documents\visual studio 2008\projects\objects\mesh.cpp 20 objects
Error 13 error C2065: 'vertices' : undeclared identifier c:\users\simon\documents\visual studio 2008\projects\objects\mesh.cpp 21 objects
Error 14 error C2059: syntax error : '{' c:\users\simon\documents\visual studio 2008\projects\objects\sprite.h 19 objects
Error 15 error C2334: unexpected token(s) preceding '{'; skipping apparent function body c:\users\simon\documents\visual studio 2008\projects\objects\sprite.h 19 objects
Error 16 error C2059: syntax error : '{' c:\users\simon\documents\visual studio 2008\projects\objects\sprite.h 23 objects
Error 17 error C2334: unexpected token(s) preceding '{'; skipping apparent function body c:\users\simon\documents\visual studio 2008\projects\objects\sprite.h 23 objects


I am either have a problem with the way in which I have inherited from the base class Sprite or it doesn't like my 2d array decleration in Sprite. I assume the undeclared identifier errors are because the inheritance isn't working correctly. Any help would be greatly appreciated.

Attachments
#include "mesh.h"
#include "glut.h"
//#include "Sprite.h"

void Mesh::initialise()
{
	Wind();
}

void Mesh::polygon(int a, int b, int c, int d)
{
//Draw a polygon via a list of vertices
	glBegin(GL_POLYGON);
		glColor3fv(colours[a]);
		glVertex3fv(vertices[a]);
		glColor3fv(colours[b]);
		glVertex3fv(vertices[b]);
		glColor3fv(colours[c]);
		glVertex3fv(vertices[c]);
		glColor3fv(colours[d]);
		glVertex3fv(vertices[d]);
	glEnd();
}

void Mesh::Wind()
{							//would be better to implement a 'for' loop here to read in the vertices
	polygon(2,3,7,6);		//i.e. for x number of facets read in next y number of values
	polygon(0,4,7,3);
	polygon(1,2,6,5);
	polygon(4,5,6,7);
	polygon(0,1,5,4);
}



/*public:
	Mesh(vertex array, facet array){return object;}
	~Mesh(){return;}*/
#ifndef _MESH_H_
#define _MESH_H_

#include "sprite.h"

class Mesh : public Sprite{

public:
	Mesh(){return;};
	~Mesh(){return;}

	//Draw a polygon via a list of vertices
	void polygon(int a, int b, int c, int d);
	//Map vertices to faces
	void Wind();
	void initialise();

};

#endif //_MESH_H_
#include "sprite.h"
#include "Mesh.h"

void Sprite::update()
{
	x = x + vx;
	y = y + vy;
	z = z + vz;
}

void Sprite::initialise()
{
	x = 0.0;
	y = 0.0;
	z = 0.0;
}

void Sprite::render(){

	Sprite::object = 1;

  glPushMatrix();
	glTranslatef(x,y,z);

	if(Sprite::object == 1)
	{
		glutWireSphere(1.0,5,5);
	}
	else if(Sprite::object == 2)
	{
		glutWireCube(5);
	}


  glPopMatrix();

}

void Sprite::calcVelocity(float t){

  vx=vx+a*t;
  vy=vy+a*t;
  vz=vz+a*t;

}
#ifndef _SPRITE_H_
#define _SPRITE_H_

#include <windows.h>
#include "glut.h"
//#include "MotionVector.h"


class Sprite{
protected:
  float x,y,z;
  float vx,vy,vz;
 // Vector motionVector;
  float a;
  float speed;
  int object;

   /* //Array of vertices used to draw a cube
  float vertices[][3] = {{-1.0,-1.0,-1.0},{1.0,-1.0,-1.0},{1.0,1.0,-1.0},{-1.0,1.0,-1.0},{-1.0,-1.0,1.0},{1.0,-1.0,1.0},
						{1.0,1.0,1.0},{-1.0,1.0,1.0}};

	//Array of values to represent colours
  float colours[][3] = {{0.0,0.0,0.0},{1.0,0.0,0.0},{1.0,1.0,0.0},{0.0,1.0,0.0},{0.0,0.0,1.0},{1.0,0.0,1.0},{1.0,1.0,1.0},
						{0.0,1.0,1.0}};*/

 public:
  Sprite(){return;}
  ~Sprite(){return;}

  //rendering function
  void render();
  //Calculate Velocity vector at time t
  void Sprite::calcVelocity(float t);
  //initialise 
  void initialise();
  //update method
  void update();


  //data management
  float getx(){return x;}
  float gety(){return y;}
  float getz(){return z;}
  float getvx(){return vx;}
  float getvy(){return vy;}
  float getvz(){return vz;}
  float geta(){return a;}
  float getspeed(){return speed;}

  void setx(float tx){x=tx;}
  void sety(float ty){y=ty;}
  void setz(float tz){z=tz;}
  void setvx(float tx){vx=tx;}
  void setvy(float ty){vy=ty;}
  void setvz(float tz){vz=tz;}
  void seta(float ta){a=ta;}
  void setspeed(float ts){speed=ts;}
};
#endif //_SPRITE_H_

In sprite.h the vertices and colours arrays can not be initialized in the class like that. It doesn't work the same as global variables. You have to put the initialization code in the class constructor.

This question has already been answered. Start a new discussion instead.