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.
c ++ c runtime-error allegro allegro5
Bruno garcia
source share