0

I keep getting an error in Code::Blocks after compiling:

 '''
    error: expected ';' after class definition
 '''

, but when I add the semicolon in, it gives me:

    internal compiler error: in gt_pch_note_object, at 
    ggc-common.c:276
    };

specifying the semicolon I had just added in behind the curly bracket. Either way, there is still an error. What is wrong with it?? The class I was writing was:

class Game{
     public:
     Game();
     ~Game();
     void init(const char* title, int xpos, int ypos, int 
     width, int height, bool fullscreen);
     void handleEvents();
     void update();
     void render();
     void clean();
     bool running();
     private:
     bool isRunning;
     SDL_Window *window;
     SDL_Renderer *renderer;
};

I was using the SDL2 library to write a game. Is something wrong with my code?

  • 1
    Given the little code you posted, what is a `SDL_Window` or `SDL_Renderer`? If I were the compiler and that is all you gave to me compile, those are the errors that would come up. – PaulMcKenzie May 10 '20 at 17:56
  • There's nothing wrong with that code. Given that your error is `internal compiler error` what made you think that code was responsible? Please post the smallest **complete** code that causes this error. – john May 10 '20 at 17:57
  • Yes, there is something wrong with the posted code. You are not defining the types `SDL_Window` and `SDL_Renderer`. There are no `#include` statements. – Thomas Matthews May 10 '20 at 17:58
  • @ThomasMatthews That code is taken out of context, that's obvious. And even if it were not it should not be causing an internal compiler error. – john May 10 '20 at 17:59
  • Technically, the error was basically pointing out the end of the class definition, specifically '};' (If I'm correct, I pointed out that the code I was showing was the class. Before that, I had '#include ' and '#include '). I don't know about the whole "out of context" thing, that might be true. – TerraMM3ou May 10 '20 at 20:33

1 Answers1

0

internal compiler errors are usually tricky and they are bugs within the compiler itself even though your code is fine.

I would suggest trying a different compiler, maybe a more recent version.

See: Similar Question

  • I'm not experienced with CodeBlocks but I never seen an internal compiler error in Visual Studio that wasn't caused by a problem in my code, and wasn't fixed by fixing my code. – john May 10 '20 at 18:01