How is an INT an invalid array subscript?
80 C:\Documents and Settings\Jimmy\Desktop\Jim'sFortress\OpenGL\Jim'sPrograms\gravity.cpp invalid types `GLfloat[int]' for array subscript
This is the line it will highlight: xPull[index] = acc * cos(xyAngle);
This is how it was declared: GLfloat xPull[MAX_PLANETS]; (MaxPlanets was defined with #define)
index was a parameter in the function
function was created as:
void updatePull(GLfloat massPull,GLfloat xPull,GLfloat yPull,GLfloat zPull,GLfloat radiusPull,int index){...}
and called as:
for(int i = 0; i < MAX_PLANETS; i++)
tester.updatePull(planets.mass,planets.x,planets.y,planets.z,planets.radius,i);
function was created as:
void updatePull(GLfloat massPull,GLfloat xPull,GLfloat yPull,GLfloat zPull,GLfloat radiusPull,int index){...}
and called as:
for(int i = 0; i < MAX_PLANETS; i++)
tester.updatePull(planets.mass,planets.x,planets.y,planets.z,planets.radius,i);
Quote:Original post by SirOnion
index was a parameter in the function
function was created as:
void updatePull(GLfloat massPull,GLfloat xPull,GLfloat yPull,GLfloat zPull,GLfloat radiusPull,int index){...}
and called as:
for(int i = 0; i < MAX_PLANETS; i++)
tester.updatePull(planets.mass,planets.x,planets.y,planets.z,planets.radius,i);
Your paramter GLfloat xPull is wrong. It should be GLfFloat *xPull.
A to why I leave that as a exercise to a reader.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement