Original Post
i have this in a header file:
class light
{
public:
color amb;
color dif;
color spec;
CVector pos;
light()
{
amb.grey();
dif.grey();
spec.white();
pos.x = 0;
pos.y = 0;
pos.z = 1 ;
}
void setup() /// for initianzation
{
glLightfv(GL_LIGHT0, GL_AMBIENT,amb.givearray());
glLightfv(GL_LIGHT0, GL_DIFFUSE,dif.givearray());
glLightfv(GL_LIGHT0, GL_SPECULAR ,spec.givearray());
glLightfv(GL_LIGHT0, GL_POSITION ,pos.v);
glEnable(GL_LIGHT0);
}
void set() /// for setting
{
glLightfv(GL_LIGHT0, GL_POSITION ,pos.v);
}
};
light ambient;
void initlight()
{
// lights
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
ambient.setup();
glMaterialfv(GL_FRONT, GL_SPECULAR, ambient.spec.givearray());
}
and it gives me a weird error ::\game002\light.h(63) : error C2146: syntax error : missing '';'' before identifier ''amb''
c:\game002\light.h(63) : error C2501: ''color'' : missing storage-class or type specifiers
c:\game002\light.h(63) : error C2501: ''amb'' : missing storage-class or type specifiers
c:\game002\light.h(64) : error C2146: syntax error : missing '';'' before identifier ''dif''
c:\game002\light.h(64) : error C2501: ''color'' : missing storage-class or type specifiers
c:\game002\light.h(64) : error C2501: ''dif'' : missing storage-class or type specifiers
c:\game002\light.h(65) : error C2146: syntax error : missing '';'' before identifier ''spec''
c:\game002\light.h(65) : error C2501: ''color'' : missing storage-class or type specifiers
c:\game002\light.h(65) : error C2501: ''spec'' : missing storage-class or type specifiers
c:\game002\light.h(101) : error C2039: ''spec'' : is not a member of ''light''
c:\game002\light.h(61) : see declaration of ''light''
c:\game002\light.h(101) : error C2228: left of ''.givearray'' must have class/struct/union type
c:\game002\glinit.h(23) : error C2039: ''amb'' : is not a member of ''light''
c:\game002\light.h(61) : see declaration of ''light''
c:\game002\glinit.h(23) : error C2228: left of ''.givearray'' must have class/struct/union type
c:\game002\glinit.h(24) : error C2039: ''dif'' : is not a member of ''light''
c:\game002\light.h(61) : see declaration of ''light''
c:\game002\glinit.h(24) : error C2228: left of ''.givearray'' must have class/struct/union type
c:\game002\glinit.h(25) : error C2039: ''spec'' : is not a member of ''light''
c:\game002\light.h(61) : see declaration of ''light''
c:\game002\glinit.h(25) : error C2228: left of ''.givearray'' must have class/struct/union type
Error executing cl.exe.
GAME002.exe - 17 error(s), 0 warning(s)
Does anyone know what this could me? I dont see anything wrong with the header file i made.