I am currently following a tutorial for Allegro 5 and when trying to use al_draw_text, I get a seg fault. After using gdb, I found that it is looking in my downloads directory for the text addon. Any idea why this would be?
I am on Linux Mint 16, using g++ 4.8.1 and Allegro 5.0.11.
GDB output:
GDB backtrace:
#0 al_draw_ustr (font=font@entry=0x0, color=..., x=x@entry=50, y=50, flags=flags@entry=0, ustr=0x7fffffffdf80) at /home/me/Downloads/allegro/addons/font/text.c:93 #1 0x00007ffff76f5183 in al_draw_text (font=0x0, color=..., x=50, y=<optimized out>, flags=0, text=<optimized out>) at /home/me/Downloads/allegro/addons/font/text.c:106 #2 0x0000000000400c41 in main () at main.cpp:29
My tutorial file:
Makefile:
Check if the font is actually loaded by verifing the retunr code of al_load_font
From what you posted it seems that GDB is looking for the source file in your downloads directory (which makes sense after all, I guess), but the SegFault seems due to invalid font pointer...which in turn may be caused by a failed load operation.
Someone will point out that you should always check return values...
Thanks! I thought I had checked it but obviously I didn't, works fine now!
That no such file or directory message is just gdb looking for the source so it can show the source at the line it crashed at. It's not a fatal error or related to the crash at all.
It is looking for the source code in the place it was compiled, which may have been on a different machine.