Hi guys
I'm new to c++/openGL (used java a lot more) and have run into an issue while trying to write a program using an array.
I have declared the array as GLfloat in the header file and then initialized it with a bunch of values in the constructor of the .cpp file. I keep getting an error so here is my code as well as the error i receive when compiling:
ERROR:
tetromino.cpp:17: error: ‘vertices’ was not declared in this scope
tetromino.cpp:17: error: expected primary-expression before ‘]’ token
tetromino.h:
GLfloat vertices[ ][3];
tetromino.cpp: (inside constructo)
initialX = 1.0;
initialY = 1.0;
initialZ = 1.0;
vertices[ ][3] = {{-initialX,-initialY,initialZ},{-initialX,initialY,initialZ},{initialX,initialY,initialZ},
{initialX,-initialY,initialZ},{-initialX,-initialY,-initialZ},{-initialX,initialY,-initialZ},
{initialX,initialY,-initialZ},{initialX,-initialY,-initialZ}};
Any sort of help as to how to fix this issue would be greatly appreciated. I have use this same array but when only using one .cpp file, no header and it worked fine but now i keep getting this error an im not sure how to fix it. Also if i use static in the declaration of the array in the header file i get rid of the first error and am left with this error:
tetromino.cpp:17: error: expected primary-expression before ‘]’ token
Thanks
Tudor