Allegro 5 crash when calling al_clear_to_color (ALLEGRO_COLOR)

I start with Allegro 5, but soon I got stuck in a second program like hello-world that I am coding. After some debugging, I came to the conclusion that the program crashes when the function al_clear_to_color(ALLEGRO_COLOR) called. I tried linking allegro statically and dynamically, but the problem still remains. I am completely lost.

Here is the code:

 #include <cstdio> #include <allegro5/allegro.h> int main() { ALLEGRO_DISPLAY *display; ALLEGRO_KEYBOARD_STATE kbState; if(!al_init()) return 0; if(!al_install_keyboard()) return 0; display = al_create_display(800, 600); if(!display) return 0; do { al_get_keyboard_state(&kbState); al_clear_to_color(al_map_rgb(255, 255, 255)); al_flip_display(); al_rest(0.5); } while(!al_key_down(&kbState, ALLEGRO_KEY_ESCAPE)); al_destroy_display(display); return 0; } 

edit:

Substituting line

 al_clear_to_color(al_map_rgb(255, 255, 255)); 

for line

 al_clear_to_color(tempClearColor); 

ads

 ALLEGRO_COLOR tempClearColor = al_map_rgb(255, 255, 255); 

before the cycle starts, it works, but the function fails

 al_destroy_display(display); 

.

The debugger returns messages:

Error reading shared libraries for C: \ Program Files (x86) \ CodeBlocks \ MinGW \ bin \ libstdC ++ - 6.dll:
SIGSEGV program signal, segmentation error.

+8
c ++ c runtime-error allegro allegro5
source share

No one has answered this question yet.

See similar questions:

2
cmath library raises runtime error in C ++
0
Error starting code using libstdc ++ 6.dll

or similar:

2
al_draw_line () failed in ALLEGRO
2
Compile Allegro 5.0.8 - static link (code :: Blocks 12.11, MinGW 4.7.1, Windows 7)
one
Porting allegro 4 to allegro 5
one
Features of Allegro 4 in Allegro 5
0
Allegro get current window size
0
How to compile atanks from windows?
0
C ++ - vector push_back () does not work after fgets ()
0
glutWarpPointer crash
0
Large Input Program Failure (C)
0
Allegro 5 and FreeBASIC

All Articles