Original Post
Having trouble with a static variable declaration, here''s my class
class terrain_patch
{
public:
//////////////////////////////////////////////////////////////////////////
// Constructors / Destructors
terrain_patch() : renderTex(true), renderLighting(true), renderPoly(true)
{
tGen = textureManager();
T_data = new t_renderData[T_length * T_length];
T_length = 257;
}
terrain_patch(int type) : renderTex(true), renderLighting(true), renderPoly(true)
{
tGen = textureManager();
switch (type)
{
case T_33x33: T_length = 33; break;
case T_65x65: T_length = 65; break;
case T_129x129: T_length = 129; break;
case T_257x257: T_length = 257; break;
}
T_type = type;
T_data = new t_renderData[T_length * T_length];
}
~terrain_patch()
{
delete[] T_data;
}
void initialize(int type);
///////////////////////////////////////////////////////////////////////////
//Assign a value to the terrain
void setVal(const int x, const int y, const float value)
{
assert ((x < T_length) && (y < T_length) && (x >= 0) && (y >= 0));
T_data[(y * T_length) + x].height = value;
}
//Get the value from the terrain
float getVal(const int x, const int y) const
{
assert ((x < T_length) && (y < T_length) && (x >= 0) && (y >= 0));
return T_data[(y * T_length) + x].height;
}
int __fastcall getLength() const { return T_length; }
void render();
void initTerrain();
protected:
int T_type; //Terrain size flag
int T_length; //Terrain length
private:
void compute_color();
void compute_texCoord();
void glVertexRender(int x, int y);
t_renderData *T_data; //Terrain data
bool renderTex;
bool renderLighting;
bool renderPoly;
static textureManager tGen; //The problem is here
unsigned int tTex;
};
Well, I can''t seem to get the static decleration of tGen to work. I don''t usualy use them, but in this case I need to, and something is obviously wrong.
I get a "
rror LNK2001: unresolved external symbol "private: static class textureManager terrain_patch::tGen" (?tGen@terrain_patch@@0VtextureManager@@A)
Debug/rSim.exe : fatal error LNK1120: 1 unresolved externals
" error. Any idea what I''m doing wrong?