Hi, I'm trying to use extern for a struct.
The struct is for vertices and is first used in a vertex class
Code:
///////////////////////////////////////////
//file vertices.h
///////////////////////////////////////////
struct vertex{
float x, y, z;
};
class VertexClass
{
vertex *vert;
...
void MakeVertices(int howmany);//make vertices
};
///////////////////////////////////////////
//file vertexData.h
///////////////////////////////////////////
//trying to use extern of above vertex struct
extern vertex *DataForVertex;
class VData
{
vertex *DataForVertex;
...
...
//I'm trying to pass one of the vertice structs from the other
//class into this
void MakeVertex()//initialise the external vertex
void GetVertexData(vertex *data)//get data from the vertices in above class
};
Basicly I'm making vertex objects in the first class and in the second class I want to pass those objects (in a loop), to do calculations on them. I think if I'm trying to pass a pointer to a whole vertex instance at once , then I also need the same type to "recieve" the data? What I'm actrually trying to pass is a VertexClass->vertex[n].
I have tried this but I get an undefined variable error for the vertex struct.
Can any one help me with this?
Thanks