Trotom Temat założony przez niniejszego użytkownika |
Podlinkowywanie Allegro5. » 2013-02-24 11:35:18 Witam, Kolejna próba, kolejny problem. Chce pracować w Code::Blocks, wykorzystując Allegro5 na Ubuntu. Wydaje się to chyba niewykonywalne. Googlowałem dużo. Od razu mówię, iż z moim angielskim jest średnio. A oto błędy jakie wywalał:
-------------- Build: Debug in Test (compiler: GNU GCC Compiler)---------------
g++ -L/home/tom/C++/biblioteki/Aktualne -L/home/tom/C++/biblioteki -L/usr/local/lib -o bin/Debug/Test obj/Debug/Test.o 'allegro-config --libs --static' obj/Debug/Test.o: In function `main': /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:7: undefined reference to `al_install_system' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:10: undefined reference to `al_show_native_message_box' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:13: undefined reference to `al_set_new_window_position' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:14: undefined reference to `al_set_new_display_flags' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:15: undefined reference to `al_create_display' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:19: undefined reference to `al_show_native_message_box' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:22: undefined reference to `al_set_window_title' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:24: undefined reference to `al_create_bitmap' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:25: undefined reference to `al_create_bitmap' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:29: undefined reference to `al_show_native_message_box' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:32: undefined reference to `al_set_target_bitmap' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:33: undefined reference to `al_map_rgb' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:33: undefined reference to `al_clear_to_color' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:34: undefined reference to `al_set_target_bitmap' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:35: undefined reference to `al_map_rgb' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:35: undefined reference to `al_clear_to_color' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:36: undefined reference to `al_get_backbuffer' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:36: undefined reference to `al_set_target_bitmap' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:37: undefined reference to `al_map_rgb_f' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:37: undefined reference to `al_clear_to_color' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:38: undefined reference to `al_draw_bitmap' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:39: undefined reference to `al_draw_bitmap' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:40: undefined reference to `al_flip_display' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:41: undefined reference to `al_rest' /home/tom/C++/projekty/Allegro 5/Test/Test.cpp:42: undefined reference to `al_destroy_display' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 25 errors, 0 warnings (0 minutes, 0 seconds)
Na ten program: #include <allegro.h> #include <allegro_native_dialog.h> ALLEGRO_DISPLAY * okno = NULL; int main() { if( !al_init() ) { al_show_native_message_box( okno, "Błąd", "hej no co?", "Nie mogę zainicjować Allegro5!\n weź się ogarnij!", NULL, ALLEGRO_MESSAGEBOX_ERROR ); return 0; } al_set_new_window_position( 20, 30 ); al_set_new_display_flags( ALLEGRO_WINDOWED ); okno = al_create_display( 320, 240 ); if( !okno ) { al_show_native_message_box( okno, "Błąd", "NULL", "Nie mogę utworzyć okna!", NULL, ALLEGRO_MESSAGEBOX_ERROR ); return 0; } al_set_window_title( okno, "Kolory i inicjowanie Allegro5" ); ALLEGRO_BITMAP * kwadrat, * prostokat = NULL; kwadrat = al_create_bitmap( 50, 50 ); prostokat = al_create_bitmap( 100, 50 ); if( !kwadrat or !prostokat ) { al_show_native_message_box( okno, "Błąd", "Coś nie tak", "Nie mogę utworzyć bitmap!", NULL, ALLEGRO_MESSAGEBOX_ERROR ); return 0; } al_set_target_bitmap( kwadrat ); al_clear_to_color( al_map_rgb( 0, 255, 0 ) ); al_set_target_bitmap( prostokat ); al_clear_to_color( al_map_rgb( 255, 0, 0 ) ); al_set_target_bitmap( al_get_backbuffer( okno ) ); al_clear_to_color( al_map_rgb_f( 1.0, 1.0, 0.0 ) ); al_draw_bitmap( kwadrat, 100, 100, 0 ); al_draw_bitmap( prostokat, 125, 125, 0 ); al_flip_display(); al_rest( 5.0 ); al_destroy_display( okno ); return 0; }
EDIT: Jeszcze trochę pogooglowałem i znalazłem stronę ( https://www.allegro.cc/forums/thread/609001), w ktrej nie rozumiem dwóch fraz, a mianowicie: Linker Settings tab -> [Link Libraries | Other linker options] -> Add the path to the libraries to link to, or add the linker flags to link to them. Link to a library named lib*.a by using -l*, where you replace * with whatever is there in the library name. Możecie mi wytłumaczyć o co tu chodzi? |
|
pekfos |
» 2013-02-24 12:35:16 'allegro-config --libs --static' A to co? |
|
Trotom Temat założony przez niniejszego użytkownika |
» 2013-02-24 12:48:45 To z Settings -> Compiler -> Linker settings -> Other linker options. |
|
Trotom Temat założony przez niniejszego użytkownika |
Odświeżam » 2013-02-24 17:01:29 Przepraszam, za podówjny post, ale chcę odświeżyć ten temat. Jeszcze trochę pogooglowałem i znalazłem stronę ( https://www.allegro.cc/forums/thread/609001), w ktrej nie rozumiem dwóch fraz, a mianowicie: " Linker Settings tab -> [Link Libraries | Other linker options] -> Add the path to the libraries to link to, or add the linker flags to link to them. Link to a library named lib*.a by using -l*, where you replace * with whatever is there in the library name. " Możecie mi wytłumaczyć o co tu chodzi? |
|
pekfos |
» 2013-02-24 20:43:23 |
|
Trotom Temat założony przez niniejszego użytkownika |
» 2013-02-24 21:18:35 Dzięki, ale mam jeszcze jedno pytanie: Trzeba to robić dla każdego projektu oddzielnie wypisując wszystkie biblioteki? |
|
mactec |
» 2013-02-24 21:22:10 @Trotom tak |
|
Trotom Temat założony przez niniejszego użytkownika |
» 2013-02-24 21:27:51 A jak podlinkować biblioteki z zakończeniem cyfrowym, np.: liballegro_dialog.so.5.0.9?Trochę inaczej. Gdy podlinkwałem dwie potrzebne do tego programu biblioteki, konsola się odpaliła i pokazała mi taki komunikat: /home/Trotom/C++/projekty/Allegro 5/Test/bin/Debug/Test: error while loading share libraries: liballegro.so.5.0: cannot open shared object file: No such file or directory
I moje zapytanie brzmi: Mam podlinkować tą bibliotekę, jeżeli tak to jak, skoro ma numer na końcu, a jeżeli nie to co mam zrobić. Edit: @up A jednak nie. Settings -> Compiler -> Linker settings -> Other linker settings |
|
« 1 » |