I installed the Allegro 5 lib with the following script:
cd ~/Documentos
sudo apt install -y git build-essential subversion cmake xorg-dev libgl1-mesa-dev libglu-dev install libpng-dev libz-dev libcurl4-gnutls-dev libfreetype6-dev libjpeg-dev libvorbis-dev libopenal-dev libphysfs-dev libgtk2.0-dev libasound-dev libflac-dev libdumb1-dev install exuberant-ctags dvi2ps dvipdfmx latex2html pandoc
git clone https://github.com/liballeg/allegro5.git allegro
sudo mv ~/Documentos/allegro /opt
cd /opt/allegro && cmake -DCMAKE_INSTALL_PREFIX=/usr .
make
sudo make install
Then I created a .c
file, I imported the lib and compiled the code with the following commands: gcc -Wall -Wextra teste.c -o Test
and gcc -lallegro -Wall -Wextra teste.c -o Test
, I received the following output:
/tmp/ccnmnCzr.o: na função 'main':
teste.c:(.text+0x1c): referência indefinida para 'al_create_display'
teste.c:(.text+0x34): referência indefinida para 'al_map_rgb'
teste.c:(.text+0x61): referência indefinida para 'al_clear_to_color'
teste.c:(.text+0x66): referência indefinida para 'al_flip_display'
teste.c:(.text+0x7b): referência indefinida para 'al_rest'
teste.c:(.text+0x87): referência indefinida para 'al_destroy_display'
collect2: error: ld returned 1 exit status
Does anyone know how to solve, search and find answers like: Returned 1 exit status - C code indicating syntax error correction, What does" collect2: error: ld returned 1 exit status "mean? indicating a possible error in the compilation process among other questions that did not make it clear how to solve, in this context of Allegro 5.
Codes I used to test:
# include <stdio.h>
# include <allegro5/allegro.h>
int main(){ // Este exemplo roda sem erros !
return 0;
}
And this example from Allegro itself (This is the example that generates the error mentioned above ).
Obs : All programs, libs ... are updated, I restarted the computer and tried other examples, but it remains the same.