J'ai essayé d'installer la bibliothèque Allegro aujourd'hui. J'ai la même expérience en C++, mais il semble que je n'en ai aucune pour faire ce genre de choses. J'ai compilé Allegro 5.0 à partir de la source et le mettre dans /usr/lib/gcc/i486-linux-gnu/4.4/include/allegro5. Mais quand je tente de compiler mon code, cela est nécessaire quand:Allegro dans Ubuntu: référence non définie à `al_install_system '
> g++ test2.cc -o test2
/home/chris/Desktop/c++/test2/.objs/main.o||In function `main':|
main.cpp:(.text+0x22)||undefined reference to `al_install_system'|
main.cpp:(.text+0x3e)||undefined reference to `al_create_display'|
main.cpp:(.text+0x6b)||undefined reference to `al_map_rgb'|
main.cpp:(.text+0x8e)||undefined reference to `al_clear_to_color'|
main.cpp:(.text+0x93)||undefined reference to `al_flip_display'|
main.cpp:(.text+0xa1)||undefined reference to `al_rest'|
main.cpp:(.text+0xa9)||undefined reference to `al_destroy_display'|
||=== Build finished: 7 errors, 0 warnings ===|
Le code J'utilise:
#include <stdio.h>
#include <allegro5/allegro.h>
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
if(!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}
display = al_create_display(640, 480);
if(!display) {
fprintf(stderr, "failed to create display!\n");
return -1;
}
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
al_rest(10.0);
al_destroy_display(display);
return 0;
}
allegro-config --libs
ne renvoie rien. J'avais Allegro en premier, mais ça n'a pas marché non plus.
/usr/lib/gcc/i486-linux-gnu/4.4/include/allegro5 n'est pas le bon endroit pour mettre inclure les fichiers de la bibliothèque. – milan
duplication possible de [Compiler le code C++ avec allegro 5 et g ++.] (Http://stackoverflow.com/questions/6377204/compiling-c-code-with-allegro-5-and-g) – karlphillip