|
Noob for linking allegro .so libs to my project |
shinprog
Member #16,805
February 2018
|
Hi, I'm new here ! and if I try to run without linking , it display this : -------------- Build: Debug in helloallegro (compiler: GNU GCC Compiler)--------------- g++ -L/usr/lib -o bin/Debug/helloallegro obj/Debug/main.o obj/Debug/main.o : Dans la fonction « main » : /home/logan/programmation/cpp/allegro/helloallegro/main.cpp:8 : référence indéfinie vers « al_install_system » /home/logan/programmation/cpp/allegro/helloallegro/main.cpp:13 : référence indéfinie vers « al_create_display » /home/logan/programmation/cpp/allegro/helloallegro/main.cpp:19 : référence indéfinie vers « al_map_rgb » /home/logan/programmation/cpp/allegro/helloallegro/main.cpp:19 : référence indéfinie vers « al_clear_to_color » /home/logan/programmation/cpp/allegro/helloallegro/main.cpp:20 : référence indéfinie vers « al_flip_display » /home/logan/programmation/cpp/allegro/helloallegro/main.cpp:21 : référence indéfinie vers « al_rest » /home/logan/programmation/cpp/allegro/helloallegro/main.cpp:22 : référence indéfinie vers « al_destroy_display » collect2: error: ld returned 1 exit status Process terminated with status 1 (0 minute(s), 0 second(s)) 0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
I'm sorry, i'm really a noob with C++ configuration... I use python, that is easyest for installing libs ... |
Scooter
Member #16,799
January 2018
|
Go to settings in code:blocks. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
All three of you are wrong. :/ With Linux variants, you want to use pkg-config to compile and link your program. That tutorial is out dated as well. Quote:
Switch to branch 5.0 for the latest stable release That's wrong. You want 'git checkout master' or 'git checkout 5.2.3'. 5.2.4 is coming out somewhat soon as well. To compile, you add /usr/local/include to your search directory for the compiler. To link, you add /usr/local/lib to your search directory for the linker. To get the compiler options allegro was built with, use : `pkg-config --cflags allegro5` and to get the linker options you need to specify, use : `pkg-config --libs allegro5` So, a complete invocation with gcc would be : gcc -Wall -Wextra -o runme `pkg-config --cflags allegro_monolith-5` main.c other.c `pkg-config --libs allegro_monolith-5` You need to have pkg-config installed when you build allegro. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
shinprog
Member #16,805
February 2018
|
H,thanks for your reply. should I try with github? EDIT : problem solved thanks to +SiegeLord of the IRC canal pkg-config --libs allegro-5 allegro_font-5 allegro_image-5 allegro_ttf-5 allegro_color-5 allegro_primitives-5 allegro_audio-5 allegro_acodec-5 allegro_memfile-5 allegro_physfs-5 2) for me,it returns -lallegro_image -lallegro_ttf -lallegro_font -lallegro_color -lallegro_primitives -lallegro_acodec -lallegro_audio -lallegro_memfile -lallegro_physfs -lallegro
3) go to project build options>Linker Settings>other linked options |
|