Allegro 5 al_init problem

I'm new to allegro and I'm trying to run this simple code

1#include <stdio.h> 2#include <allegro5/allegro.h> 3#include <allegro5/allegro_native_dialog.h> 4 5int main(void) 6{ 7 ALLEGRO_DISPLAY *display; 8 9 if( !al_init() ) 10 { 11 al_show_native_message_box( NULL, NULL, "Error", "Couldnt initialize Allegro 5", NULL, ALLEGRO_MESSAGEBOX_ERROR ); 12 return -1; 13 } 14 15 display = al_create_display( 800, 600 ); 16 17 if( !display ) 18 { 19 al_show_native_message_box( display, " Sample Title", "Display Settings", "Display window unable to display", NULL, ALLEGRO_MESSAGEBOX_ERROR ); 20 } 21 22 al_show_native_message_box( display, "Message box title", "Error", "Display window could not be shown", NULL, ALLEGRO_MESSAGEBOX_ERROR ); 23 24 al_destroy_display( display ); 25 26 return 0; 27}

Every time I run it I get the "Couldnt initialize Allegro 5" message box instead of "Display window could not be shown". I tried code similar to mine( as in !al_init returning true ) and i get the same problem.

Any help will be greatly appreciated.

Trent Gamblin

What operating system? Is it a really old computer? I don't know.


im running ubuntu 13.04 64bit and my computer is pretty good(cpu: intel i5, gpu: ati 4850, ssd harddrive, ect.)

Trent Gamblin

Did you by any chance mix up any previous installation of Allegro with the current one? This may happen if you have headers from a different version of the library installed than the library itself was built with.

Matthew Leverton

Did you by any chance mix up any previous installation of Allegro with the current one?

Yes, he did. I'll put 50 cents toward your next game if I am wrong.

#include <allegro5/allegro.h>
#include <stdio.h>

int main()
  printf("%0x\n%0x\n", ALLEGRO_VERSION_INT, al_get_allegro_version());
  return 0;


ran the code and got

so i assume i have two, so how do i uninstall one.???

Matthew Leverton

That means you are compiling against Allegro 5.1 headers, but are linking against Allegro 5.0.

You could delete the 5.0 libraries from /usr/local/lib, although depending on what you've done to get to this point, there may be something else going on.


i got it working, just deleted everything.

Thread #612825. Printed from