Okay, trying to compile a program, but XCode is going really screwy . First, the code snippet:
if (direction)
{
switch (rot)
{
case 0:
{
Point2i temp = p1;
p1 = p2;
p2 = p3;
temp.setx (temp.getx() + TILESIZE);
p3 = temp;
rot = 3;
break;
}
case 1: p3.sety (p3.gety() - TILESIZE);
rot = 0;
break;
case 2: p2.setx (p2.getx() - TILESIZE);
rot = 1;
break;
case 3: p1.sety (p1.gety() - TILESIZE);
rot = 2;
break;
}
}
else
{
switch (rot)
{
case 0: p3.sety (p3.gety() - TILESIZE);
rot = 1;
break;
case 1: p2.setx (p2.getx() + TILESIZE);
rot = 2;
break;
case 2: p1.sety (p1.gety() + TILESIZE);
rot = 3;
break;
case 3: Point2i temp = p3;
p3 = p2;
p2 = p1;
temp.setx (temp.getx() - TILESIZE);
p1 = temp;
break;
}
}
On the first switch, it chokes on the 'case 0:' line, complaining that
Quote:
error: crosses initializtion of 'Point2i temp'
Not only that, but that one error is reported 3 times, along with this error on each of the following case lines within that section of the if.
Quote:
error: jump to case label
Oddly, the else portion works fine as is.
I did find these could be eliminated simply by declaring the variable BEFORE the switch, although that means it will be created EVERY time it's called instead of in just the one case where it's needed.
To add insult to injury, if I change it to the way it will work, it then throws me this error:
Quote:
Undefined symbols:
_TILESIZE
Which makes no sense, considering:
const extern int TILESIZE;
is in the Tring.h header file it includes, along with the definition
const int TILESIZE = 10;
in main.cpp
So what the heck exactly is going on? At this point, I'm at a complete loss. Not to mention it's a heck of a way to start my second day of working with XCode [razz]
[Edited by - Charabis on March 8, 2007 4:31:44 PM]
My name is "Todd". Drop the "T" and it explains sooooooo much! :P