how to install install Allegro 5 with codelite on xubuntu ?
dolphin swimming

Hi, I watched this video and the program below is working fine.

//*** Programme de test Allegro 5 ***

#include <stdlib.h>
#include <time.h>
#include <allegro5/allegro.h>
#include <allegro5/allegro_native_dialog.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>

//*** Inclusion des fonctions ***
//#include <fonctions.h>

//*** Fonction main ***

int main()
// initialisation Allegro 5, quite si echou
if(!al_init()) return -1;

// pour obtenir une fenĂȘtre

ALLEGRO_KEYBOARD_STATE key; // clavier simple

int fin=0; // pour la boucle de jeu
unsigned char r,v,b; // rouge vert bleu (0 - 255)

srand(time(NULL)); // initialisation azar

// creation de la fenetre

// quite si le display a echoue
if(!display) return -1;

// install le clavier
if(!al_install_keyboard()) return -1;

// install la souris
if(!al_install_mouse()) return -1;

// install le joystick
if(!al_install_joystick()) return -1;

//if(!al_init_font_addon()) return -1; // init pour le text font
//if(!al_init_ttf_addon()) return -1; // init pour le text ttf
//if(!al_init_primitives_addon()) return -1; // init pour les primitives graphiques

//ALLEGRO_FONT *font24 = al_load_font("Starjhol.ttf",24,0);

// donner un nom Ă  sa fenetre
al_set_window_title( display, "Premier programme avec CodeLite & Allegro5");

// colorer la fenetre

al_get_keyboard_state(&key); // recuperation etat du clavier

if(al_key_down(&key,ALLEGRO_KEY_ESCAPE)) fin=1; // fin de boucle si touche echap down

// changement de couleur du fond si touche entree down

// affiche le display

// colorer la fenetre

// affiche le display

// temps d'attente en secondes

// liberation memoire de la fenetre

// tout desinstaller

return 0;

But except for this:

if(!al_init_font_addon()) return -1;
if(!al_init_ttf_addon()) return -1;
if(!al_init_primitives_addon()) return -1;

So with this three lines I have several errors like :
"undefined reference to `al_init_font_addon'",
"undefined reference to `al_init_ttf_addon'"
"undefined reference to `al_init_primitives_addon'"

I am not a professional programmer, only a beginner hobbyist.
Do you have a solution ?



You can either link the massive monolith library that includes everything. Or link to the individual libraries for each addon. Look at the libraries folder/directory for the names.

dolphin swimming


Thanks, but I don't have a file named "monolith" in my DD.

Do you have an example for proceed for this ?

"link to the individual libraries for each addon. Look at the libraries folder/directory for the names."

Edgar Reynaldo

The libraries you need to link will be named something like :


Look in your /usr/lib or /usr/local/lib directory for the allegro libraries you need to link.

The monolith library doesn't come in the repositories on Linux AFAIK.

dolphin swimming

Hi thanks.

Yes I have several "liballegro_*.so" on /usr/lib/x86_64-linux-gnu

For installing Allegro 5 I proceeded like this:

sudo add-apt-repository ppa:allegro/5.2
sudo apt update
sudo apt upgrade

sudo apt install liballegro5-dev

In CodeLite:

New Project -> Console -> Simple executable (gcc)
Then in Settings Projet "allegrotest" (name)

Compiler -> Include Paths -> /usr/include
Linker -> Libraries Search Path -> /usr/lib
Linker -> Libraries -> allegro

and now:

Linker -> Libraries Search Path -> /usr/lib
Linker -> Libraries Search Path -> /usr/lib/x86_64-linux-gnu

But I have the same errors.

Edgar Reynaldo

There is more than one allegro library to link, because allegro comes with a series of addons.

In your linker libraries tab, add,, and, in addition to any other addon libraries you are using. You'll know which ones because you had to include their header to use them.

dolphin swimming

YES very good answers thanks very much. Now I have "====0 errors, 0 warnings====" in CodeLite.

Linker -> Libraries -> allegro

With other libraries like this:


Thanks a lot Edgar Reynaldo :D

Thread #618369. Printed from