Where is the error coming from?
For the life of me, I have been unable the last two days to locate what I am doing wrong in the following function. The error given is C2143: missing ':' before ';'. This is on the 15th line of the function.
int NumFront=0, NumBack=0, NumPlanar=0;
int nClass;
// cast away const
cPolygon *pPoly = (cPolygon *)&Poly
int NumPoints = pPoly->GetNumPoints();
// loop through all points
for (int i=0; i < NumPoints; i++)
{
nClass = Classify(pPoly->m_pPoints);
switch(nClass)
{
case MFRONT:
NumFront++;
break;
case MBACK:
NumBack++;
break;
default:
NumFront++;
NumBack++;
NumPlanar++;
break;
}
} // for
// all points are planar
if (NumPlanar == NumPoints) {
return MPLANAR;
}
// all points are in front of plane
else if (NumFront == NumPoints) {
return MFRONT;
}
// all points are on backside of plane
else if (NumBack == NumPoints) {
return MBACK;
}
// poly is intersecting the plane
else {
return MCLIPPED;
}
Please help, if you can. I am completely at a standstill for what the problem is.
Since i can only guess that line 15 is the first case:
What are MFRONT, MBACK? Defines? Enums? Check, if they collide with other defines that might be defined with the same name. Try to rename them. If they're enums, put them in a namespace.
What are MFRONT, MBACK? Defines? Enums? Check, if they collide with other defines that might be defined with the same name. Try to rename them. If they're enums, put them in a namespace.
Could be how you've defined MFRONT. If it's defined as
then the 15th line becomes equivalent to:
which will give you the error you're experiencing. You need to use either of these two:
Of course, I'm only guessing what the value for MFRONT is. [grin]
#define MFRONT 1;
then the 15th line becomes equivalent to:
case 1;:
which will give you the error you're experiencing. You need to use either of these two:
#define MFRONT 1 // ORconst int MFRONT = 1;
Of course, I'm only guessing what the value for MFRONT is. [grin]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement