Search code examples
c++compiler-errorscodeblocksallegro

"error: stray \255 in program" on Raspberry Pi


I'm having a problem in my program that I do not quite understand. The code itself looks perfectly fine. Also, I find it strange that this code works in Code::Blocks for Raspberry Pi, but not on Code::Blocks for the CHIP computer. Here is the stack trace:

home/chip/Desktop/SuperLuigiBros/startScreen.cpp:41:4: error: stray \255 in program

Here is the code:

File startScreen.cpp

createBrickArea(-15,600, 40, 20, "brBrick");

File brick.cpp:

void createBrickArea(int x, int y, int numBricks, int numRows, string brickType) {
    int brShadowWidth = 32;
    int brShadowHeight = 32;

    for (int i = 0; i <= numRows; i++) {
        if (brickType == "brick") {
            if (i == 0) {
                createBrickRow(x, y + 1, numBricks, "topBrick");
            }

            if (i % 2 == 0 && i != 0) {
                createBrickRow(x, y + 8 * i, numBricks, brickType);
            }

            if (i % 2 != 0 && i != 0) {
                createBrickRow(x + 8, y + 8 * i, numBricks, brickType);
            }
        }

        if (brickType == "brBrick") {
            createBrickRow(x, y + brShadowHeight * i, numBricks, brickType);
        }
    }
}

Solution

  • You have a character in your source file that isn't in the basic source character set. The error message tells you the location and value of that character: it's in column 4 of line 41 of startScreen.cpp. I don't think you've pasted the correct line of startScreen.cpp so I can't point it out, but you should delete that character.