KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm starting at Allegro 5, but soon I got stuck in the second hello-world-like program I'm coding. After some debugging, I concluded that the program crashes when it calls the function al_clear_to_color(ALLEGRO_COLOR) . I've tried linking allegro statically and dynamically, but the problem still remains. I'm 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 the line al_clear_to_color(al_map_rgb(255, 255, 255)); for the line al_clear_to_color(tempClearColor); declaring ALLEGRO_COLOR tempClearColor = al_map_rgb(255, 255, 255); before the loop starts, it does work, but crashes when the function al_destroy_display(display); is called. The debugger returns the messages: Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll: Program received signal SIGSEGV, Segmentation fault.
Tags (comma-separated)
Save Edits
Cancel