I set up Allegro 5, and could compile the following code with success:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <allegro5/allegro.h>
void error(char *msg)
{
fprintf(stderr,"%s : %s\n", msg, strerror(errno));
exit(1);
}
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
if(!al_init())
error("Could not initailize allegro");
display = al_create_display(640, 480);
if(!display)
error("fail to display");
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
al_rest(10.0);
al_destroy_display(display);
return 0;
}
But after running it, it failed with the error message:
Could not initailize allegro : No such file or directory.
I don't know what is wrong. My OS is Ubuntu, I'd compiled the code successfully with:
gcc try.c -lallegro
But could not run it with:
./a.out