|
How to call function al_draw_multiline_text? |
thatrabbit
Member #18,225
August 2020
|
Hello. I am running latest version of Allegro. I see this function in docs: https://liballeg.org/a5docs/trunk/font.html#al_draw_multiline_text In my code I have at least: 1#include <allegro5/allegro_font.h>
2#include <allegro5/allegro_ttf.h>
3...
4al_init_font_addon();
5al_init_ttf_addon();
6...
When I compile, I am told "undefined reference to <al_draw_multiline_text>". How do I use that function? I can use al_draw_text okay. If I can get built-in newlines that helps a lot. |
kenmasters1976
Member #8,794
July 2007
|
Does ex_font_multiline from the Allegro examples work?.
|
RmBeer2
Member #16,660
April 2017
|
You also need to link their library. (-lallegro_font -lallegro_ttf) 🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈 Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
LennyLen
Member #5,313
December 2004
|
RmBeer2 said: You also need to link their library. (-lallegro_font -lallegro_ttf) I think it's safe to assume he's linking correctly if al_draw_text() is working. My low-tech suggestion - are you sure you spelled the function correctly?
|
bamccaig
Member #7,536
July 2006
|
Which version of Allegro do you have installed? Seems that function was added in 5.1.9. If you spelled it correctly and al_draw_text works then too old of a distribution seems like the only explanation left. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Mark Oates
Member #1,146
March 2001
|
Also possible you may be using the wrong function signature, which can result in an undefined reference. -- |
bamccaig
Member #7,536
July 2006
|
That's true, but only if he forward declared the signature himself. Otherwise, the compiler would choke before the linker was invoked. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
RmBeer2
Member #16,660
April 2017
|
What signature?? i get lost... 🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈 Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
Edgar Reynaldo
Major Reynaldo
May 2007
|
al_draw_multiline_text was added in Allegro 5.1.9. You must be linking to an old version of allegro, or not linking to the allegro font addon. 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 |
bamccaig
Member #7,536
July 2006
|
RmBeer2 said: What signature?? i get lost...
1void f1(int * x)
2{
3 *x *= 2;
4}
1void f1(const char *);
2
3int main(int argc, char * argv[])
4{
5 f1("Hello, World!\n");
6
7 return 0;
8}
g++ -Wall f1.cpp -c g++ -Wall main.cpp -c g++ -Wall f1.o main.o main.o: In function `main': main.cpp:(.text+0x17): undefined reference to `f1(char const*)' collect2: error: ld returned 1 exit status f1 is a real function, and it has been linked, but the signature doesn't match the one expected by main.o. Interesting to note that C did not care at all. It compiled and linked without errors. Then it segfaulted at runtime. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
RmBeer2
Member #16,660
April 2017
|
f1.cpp: _Z2f1Pi This's a signature? i see... Saying they have different parameters looks less confusing. Although this is what makes C++ stackable with the same function name. In that case he should show what is the source code, the compilation line and the compilation output. To be more sure. 🌈🌈🌈 🌟 BlackRook WebSite (Only valid from my installer) 🌟 C/C++ 🌟 GNU/Linux 🌟 IceCream/Cornet 🌟 🌈🌈🌈 Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
Mark Oates
Member #1,146
March 2001
|
That's a great example, BAM. -- |
thatrabbit
Member #18,225
August 2020
|
Wow. Thank-you for all the replies! I should have checked back sooner. I realized multi-line would not help me in this case. Still it is good to know it exists, and I will refer back here when the time comes. Cheers all! -- edit Edgar Reynaldo said: You must be linking to an old version of allegro Was correct. I am using 5.0.10. Time to upgrade. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I have some binaries for Allegro 5.2.5 and MinGW-W64 gcc 8.1.0 on my bitbucket download page. I haven't updated my binary package to 5.2.6 yet, which you can find on the official download page. Links: Allegro 5.2.5 and Allegro 4.4.3 https://bitbucket.org/bugsquasher/unofficial-allegro-5-binaries/src/master/ https://bitbucket.org/bugsquasher/unofficial-allegro-5-binaries/downloads/ Official binaries : 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 |
|