c++ - case break causing error while compiling with gcc -
error while compiling error: break statement not within loop or switch case label 'not within switch statement
i couldn't attach whole code because it's bug if insist see whole thing let me know , i'll upload how.
void s9xsetupdefaultkeymap() { s9xunmapallcontrols(); // build key map s9xcommand_t cmd; // player 1 s9xmapbutton( 65, cmd = s9xgetcommandt("joypad1 left"), false ); // s9xmapbutton( 68, cmd = s9xgetcommandt("joypad1 right"), false ); // d s9xmapbutton( 87, cmd = s9xgetcommandt("joypad1 up"), false ); // w s9xmapbutton( 83, cmd = s9xgetcommandt("joypad1 down"), false ); // s s9xmapbutton( 79, cmd = s9xgetcommandt("joypad1 x"), false ); // o s9xmapbutton( 80, cmd = s9xgetcommandt("joypad1 y"), false ); // p s9xmapbutton( 75, cmd = s9xgetcommandt("joypad1 a"), false ); // k s9xmapbutton( 76, cmd = s9xgetcommandt("joypad1 b"), false ); // l s9xmapbutton( 88, cmd = s9xgetcommandt("joypad1 l"), false ); // x s9xmapbutton( 77, cmd = s9xgetcommandt("joypad1 r"), false ); // m s9xmapbutton( 13, cmd = s9xgetcommandt("joypad1 start"), false ); // enter s9xmapbutton( 16, cmd = s9xgetcommandt("joypad1 select"), false ); // shift // player 2 s9xmapbutton( 70, cmd = s9xgetcommandt("joypad2 left"), false ); // f s9xmapbutton( 72, cmd = s9xgetcommandt("joypad2 right"), false ); // h s9xmapbutton( 84, cmd = s9xgetcommandt("joypad2 up"), false ); // t s9xmapbutton( 71, cmd = s9xgetcommandt("joypad2 down"), false ); // g s9xmapbutton( 67, cmd = s9xgetcommandt("joypad2 x"), false ); // c s9xmapbutton( 86, cmd = s9xgetcommandt("joypad2 y"), false ); // v s9xmapbutton( 66, cmd = s9xgetcommandt("joypad2 a"), false ); // b s9xmapbutton( 78, cmd = s9xgetcommandt("joypad2 b"), false ); // n s9xmapbutton( 89, cmd = s9xgetcommandt("joypad2 l"), false ); // y s9xmapbutton( 85, cmd = s9xgetcommandt("joypad2 r"), false ); // u s9xmapbutton( 81, cmd = s9xgetcommandt("joypad2 start"), false ); // q s9xmapbutton( 69, cmd = s9xgetcommandt("joypad2 select"), false ); // e case "joypad1 down": break; case "joypad1 x": break; case "joypad1 y": break; case "joypad1 a": break; case "joypad1 b": break; case "joypad1 l": break; case "joypad1 r": break; case "joypad1 start": break; case "joypad1 select" break; // player 2 case "joypad2 left": break; case "joypad2 right": break; case "joypad2 up": break; case "joypad2 down": break; case "joypad2 x": break; case "joypad2 y": break; case "joypad2 a": break; case "joypad2 b": break; case "joypad2 l": break; case "joypad2 r": break; case "joypad2 start": break; case "joypad2 select": break;
example syntax case
switch (variable) { case 1: //do stuff break; case 2: //do stuff break; default: //do stuff break; }
remember using switch statement can proces integer variables. , need specify, variable case
statements refer using switch
statement. if you'll insist on testing char*
variable, behaviour different expect, you'll comparing pointers, not content of char*
array.
in case, you'll better of using if
, else if
.
Comments
Post a Comment