我想今天安裝快板庫。我在C++方面有相同的經驗,但似乎我沒有這樣的東西。我從源代碼編譯了Allegro 5.0並將其放在/usr/lib/gcc/i486-linux-gnu/4.4/include/allegro5中。但是,當我嘗試編譯我的代碼,這樣出現:Allegro在Ubuntu的:未定義的引用`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 ===|
的代碼我使用:
#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
回報什麼。我首先將Allegro作爲包裝,但它也不起作用。
/usr/lib/gcc/i486-linux-gnu/4.4/include/allegro5不把正確的地方庫的包含文件。 – milan 2011-03-09 08:53:58
可能重複的[編譯的C++代碼與快板5和g ++](http://stackoverflow.com/questions/6377204/compiling-c-code-with-allegro-5-and-g) – karlphillip 2011-06-16 20:22:20