|
TTF problem |
bhq009
Member #15,812
November 2014
|
Hi guys, this is my first post here I have problem with using fonts. This is my code: 1#define ALLEGRO_STATICLINK
2#include <allegro5/allegro.h>
3#include <allegro5/allegro_font.h>
4#include <allegro5/allegro_ttf.h>
5
6int main(){
7 al_init();
8 al_init_font_addon();
9
10 //error here!
11 al_init_ttf_addon();
12
13 ALLEGRO_DISPLAY *display = al_create_display(640,480);
14 al_clear_to_color(al_map_rgb(255,255,10));
15
16
17
18 al_flip_display();
19 al_rest(3);
20 al_destroy_display(display);
21 return 0;
22}
Everything goes fine, but when i try to initialize TTF addon, this is what shows up: Other addons, like Images or Primitives work correctly, the only problem is with TTF. I've linked everything correctly. I use Code::Blocks, MinGW and Windows 8. Can you help me? And sorry for my bad engrish, it's not my first language |
Arthur Kalliokoski
Second in Command
February 2005
|
The undefined references say that you didn't link everything correctly. Did you link to allegro_ttf and allegro_font? They all watch too much MSNBC... they get ideas. |
bhq009
Member #15,812
November 2014
|
Yes, i think it's all right. This is linker list: There are three more MinGW libraries on the list (libadvapi32.a, libws2_32.a, libshlwapi.a). Or is there way to display texts without use of TTF? |
Arthur Kalliokoski
Second in Command
February 2005
|
I guess you have to specify quite a few libraries separately with static linking. For what it's worth, the functions you're missing are from FreeType, possibly it doesn't allow static linking, so you'd have to look for the dll equivalent. They all watch too much MSNBC... they get ideas. |
pkrcel
Member #14,001
February 2012
|
My experience with freetype is that it allows for static linking, thou ordering is important in that case...I don't know ith that libfreetype in the OP screenshot is in the right spot. It is unlikely that Google shares your distaste for capitalism. - Derezo |
Arthur Kalliokoski
Second in Command
February 2005
|
Yeah, I didn't see that libfreetype, getting in a hurry again. They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
You need to link to allegro_ttf first, then allegro_font, then allegro then freetype and the rest of the static libs. The whole list is here : -ldumb -lFLAC -lvorbisfile -lvorbis -lfreetype -logg -lz -lgdiplus -luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32 -lshlwapi
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 |
bhq009
Member #15,812
November 2014
|
Yes, it works now! I changed the linking order, just like Edgar said. Now everything is perfectly fine. Thank you guys! |
|