-
"class" errors!
I'm getting really angry with this! I want to create a class for my OpenGL Pong game! When I do this:
class P
{
public:
void setp(GLfloat x, GLfloat y);
private:
GLfloat p1x;
GLfloat p1y;
}; P PDAT[2];
void P::setp(GLfloat x, GLfloat y)
{
p1x = x;
p1y = y;
}
PDAT[0].setp(0.0f, 0.0f);
When I do this, it returns:
33 w32p3d.cpp
syntax error before `.'
Why does it do this?
-
You cannot call a function from a global position in your code.
Put
PDAT[0].setp(0.0f, 0.0f);
inside main() or some other function and it will most likely work.