Advertisement

Error C2108 in english please??

Started by July 22, 2003 01:33 PM
13 comments, last by adam17 21 years, 7 months ago
i keep getting the error: "error C2108: subscript is not of integral type" can anyone tell me what this means in english? i looked over the msdn but they told me the same thing.
You are probably not using the correct data type for an array subscript. Post some code.
Advertisement
GLuint Draw_Triangles(){	int v1, v2, v3;	map = glGenLists(1);	glNewList(map, GL_COMPILE);	for(int loop1=0; loop1<num_obj; loop1++)	{		glBegin(GL_TRIANGLES);				for(int loop2=0; loop2<Mesh_array[loop1].num_faces; loop2++)		{			v1 = Mesh_array[loop1].vertex[Mesh_array[loop1].face[loop2].x]->x;			v2 = Mesh_array[loop1].vertex[Mesh_array[loop1].face[loop2].x]->y;			v3 = Mesh_array[loop1].vertex[Mesh_array[loop1].face[loop2].x]->z;			glVertex3f(v1, v2, v3);			v1 = Mesh_array[loop1].vertex[Mesh_array[loop1].face[loop2].y]->x;			v2 = Mesh_array[loop1].vertex[Mesh_array[loop1].face[loop2].y]->y;			v3 = Mesh_array[loop1].vertex[Mesh_array[loop1].face[loop2].y]->z;			glVertex3f(v1, v2, v3);			v1 = Mesh_array[loop1].vertex[Mesh_array[loop1].face[loop2].z]->x;			v2 = Mesh_array[loop1].vertex[Mesh_array[loop1].face[loop2].z]->y;			v3 = Mesh_array[loop1].vertex[Mesh_array[loop1].face[loop2].z]->z;			glVertex3f(v1, v2, v3);		}		glEnd();	}	glEndList();	return map;}

".vertex" is a struct of 3 values for vertices. ".face" is also. hope this helps.
Mesh_array[loop1].face[loop2].x <- my guess is that x is a float and subscripts like integers.
ASCII stupid question, get a stupid ANSI
array[float]

is not a valid way to access an array.
it means you''re using a non-integral type as a subscript.. like uh.. a float, or double, or char, etc..

for example, the following code would produce that error:
for(double x = 0; x < 10; x++){   myarray[x] = 0;} 

because x is not of an integral type


-eldee
;another space monkey;
[ Forced Evolution Studios ]

::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

-eldee;another space monkey;[ Forced Evolution Studios ]
Advertisement
i changed the data types to int and it compiles and everything. now im just having the problem of it crashing. it just runs and then says "would you like to send error information to microsoft..." like thats going to work. anyway does anyone see a memory leak or maybe just somethin that would cause it to crash?

thanks for the tip to change the data types
... run it under debug mode and see what line causes it to crash.
dammit dammit dammit!!! this error: "The thread 0xB4 has exited with code -1073741819 (0xC0000005)" means there is a range checking error right?!? if there is any other meaning to this PLEASE tell me.
Do what hawkeye said

Find out where the crash is. If you have the DirectX DLLs set on debug mode that might also give you some clues as to why it''s crashing.

This topic is closed to new replies.

Advertisement