Allegro unable to load font
Bob Keane

I am following the tutorials for allegro 5 and running into a problem. I copied this code from the guide, downloaded the font from the page and copied it to the folder with the executable per the page. When I run the program, I get the error the font could not be loaded. I assumed the download may have been corrupted so I googled and downloaded the font from the web and tried again. Still no luck. I tried using one of the fonts from my distro and it did not work. I checked the forums, and this thread suggests I may have a buggy version of allegro so I removed and reinstalled Allegro through package manager. Still no luck. Any ideas

Edgar Reynaldo

See Current Working Directory.

You have to run the exe from the folder where it is located. CB will run it from a different directory, depending on whether or not you've changed your project structure.

To fix this permanently, and to offer a more flexible solution, you can change the current working directory yourself using allegro 5 :

ALLEGRO_PATH* p = al_get_standard_path(ALLEGRO_RESOURCES_PATH);
al_change_directory(al_path_cstr(p , ALLEGRO_NATIVE_PATH_SEP));
p = 0;

Bob Keane

Always something simple. Thanks.

Someone may want to take a look at the tutorial, this is what I get:


Thread #617730. Printed from