I have to ask about an error which I encounter from time to time but don't understand.
In gl.h GLfloat is typedefed as a regular float.
so why is there a difference between the classes posted below?
When I try to compile the one with GLfloat type I get the following errors. ( I have not forgotten to link with Opengl32.lib)
Code:
..\include\gl\gl.h(1152) : error C2144: syntax error : missing ';' before type 'void'
..\include\gl\gl.h(1152) : error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
..\include\gl\gl.h(1152) : fatal error C1004: unexpected end of file found
Thank you for your time
Code:
#ifndef __c_color
#define __c_color
class c_color {
public:
c_color(): r(1.0f),g(1.0f),b(1.0f) {}
c_color(float r_in, float g_in, float b_in): r(r_in), g(g_in), b(b_in){}
float get_r(){ return r;}
float get_g(){ return g;}
float get_b(){ return b;}
private:
float r;
float g;
float b;
};
#endif //__c_color
and:
Code:
#ifndef __c_color
#define __c_color
#include <gl/gl.h>
class c_color {
public:
c_color(): r(1.0f),g(1.0f),b(1.0f) {}
c_color(GLfloat r_in, GLfloat g_in, GLfloat b_in): r(r_in), g(g_in), b(b_in){}
GLfloat get_r(){ return r;}
GLfloat get_g(){ return g;}
GLfloat get_b(){ return b;}
private:
GLfloat r;
GLfloat g;
GLfloat b;
};
#endif //__c_color