Jump to content
  • Advertisement
Sign in to follow this  
Running_Wolf

Where is the error coming from?

This topic is 4822 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Could be how you've defined MFRONT. If it's defined as

#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     // OR
const int MFRONT = 1;



Of course, I'm only guessing what the value for MFRONT is. [grin]

Share this post


Link to post
Share on other sites
That you Poss74, you hit it right on the dollar. I had #define MFRONT 1;. I knew it had to be something obvious that I was missing. Brain fart. Thanks for the help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!