Debug Error!
Czar05

I keep getting a debug error for the following code...

#SelectExpand
1#include <allegro5\allegro.h> 2#include <allegro5\allegro_primitives.h> 3#include <allegro5\allegro_font.h> 4#include <allegro5\allegro_ttf.h> 5#include <math.h> 6 7 8int main() 9{ 10 11 bool done = false; 12 int FPS = 60; 13 int count = 0; 14 15 al_init(); // Initializes allegro 16 17 al_set_new_display_flags(ALLEGRO_WINDOWED); 18 al_set_new_display_refresh_rate(60); // The refresh rate for display 19 20 ALLEGRO_DISPLAY *display = al_create_display(900,900); // Creates a display 900 * 900 (height * width) 21 al_set_window_title(display, "Testing"); // Names the establised window 22 23 ALLEGRO_EVENT_QUEUE *event_queue = al_create_event_queue(); // Establishes a queue 24 25 ALLEGRO_TIMER *timer = NULL; // Creates the timer variable 26 timer = al_create_timer(1/FPS); // Makes timer run at 60 frames per second 27 28 al_register_event_source(event_queue, al_get_display_event_source(display)); // Places the display on queue 29 30 al_start_timer(timer); 31 al_init_primitives_addon(); // Initializes primitives 32 33 34 al_init_font_addon(); // Initializes fonts 35 al_init_ttf_addon(); 36 37 ALLEGRO_FONT *font18 = al_load_font("font1.ttf", 18,0); 38 39 while(!done) // The game/application loop 40 { 41 ALLEGRO_EVENT ev; 42 al_wait_for_event(event_queue, &ev); 43 44 count++; 45 al_draw_textf(font18 ,al_map_rgb(255,255,255), 50, 50, ALLEGRO_ALIGN_LEFT, "Frames: %i", count); 46 47 if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) // Makes the window close 48 { 49 50 done = true; 51 } 52 53 al_flip_display(); 54 al_clear_to_color(al_map_rgb(0,0,0)); 55 } 56 57 al_destroy_event_queue(event_queue); 58 al_destroy_display(display); 59 60 return 0; 61}

here are the output debug

#SelectExpand
1'Random_Motion.exe': Loaded 'C:\Users\Yankho\Documents\Visual Studio 2010\Projects\Random_Motion\Debug\Random_Motion.exe', Symbols loaded. 2'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file 3'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file 4'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file 5'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\allegro-5.0.6-monolith-md-debug.dll', Cannot find or open the PDB file 6'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\psapi.dll', Cannot find or open the PDB file 7'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file 8'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file 9'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file 10'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file 11'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file 12'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file 13'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file 14'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file 15'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file 16'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file 17'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file 18'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file 19'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file 20'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file 21'Random_Motion.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17825_none_72d273598668a06b\GdiPlus.dll', Cannot find or open the PDB file 22'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\comdlg32.dll', Cannot find or open the PDB file 23'Random_Motion.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_ec83dffa859149af\comctl32.dll', Cannot find or open the PDB file 24'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file 25'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file 26'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file 27'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file 28'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file 29'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file 30'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file 31'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file 32'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file 33'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded. 34'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file 35'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file 36'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\d3d9.dll', Cannot find or open the PDB file 37'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file 38'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\d3d8thk.dll', Cannot find or open the PDB file 39'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file 40'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\aticfx32.dll', Cannot find or open the PDB file 41'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\atiu9pag.dll', Cannot find or open the PDB file 42'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\atiumdag.dll', Cannot find or open the PDB file 43'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\atiumdva.dll', Cannot find or open the PDB file 44'Random_Motion.exe': Unloaded 'C:\Windows\SysWOW64\atiumdva.dll' 45'Random_Motion.exe': Unloaded 'C:\Windows\SysWOW64\atiumdag.dll' 46'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\atiumdag.dll', Cannot find or open the PDB file 47'Random_Motion.exe': Loaded 'C:\Windows\SysWOW64\atiumdva.dll', Cannot find or open the PDB file 48'Random_Motion.exe': Loaded 'C:\Program Files (x86)\ATI Technologies\HydraVision\HydraDMH.dll', Binary was not built with debug information. 49The thread 'Win32 Thread' (0x508) has exited with code 3 (0x3). 50The thread 'Win32 Thread' (0x1488) has exited with code 3 (0x3). 51The thread 'Win32 Thread' (0x1c10) has exited with code 3 (0x3). 52The thread 'Win32 Thread' (0x1e78) has exited with code 3 (0x3). 53The thread 'Win32 Thread' (0x1c70) has exited with code 3 (0x3). 54The thread 'Win32 Thread' (0x1dac) has exited with code 3 (0x3). 55The thread 'Win32 Thread' (0x1dd4) has exited with code 3 (0x3). 56The thread 'Win32 Thread' (0xa08) has exited with code 3 (0x3). 57The thread 'Win32 Thread' (0x1868) has exited with code 3 (0x3). 58The program '[6896] Random_Motion.exe: Native' has exited with code 3 (0x3).

It is a R6010 and tells me to abort. The output window also says assertion failed: font,file allegro-5.0.x\addons\font\text.c, line 198. Any ideas? Thanks in advance

Gnamra

is the ttf file is placed in the same folder as your source files?

someone972

You should be checking things that can fail, such as loading the font. It will return NULL if it fails to find the file or has some other error. Checking against this and displaying a message is an easy way to debug what is wrong. Needless to say, most functions don't like it when they expect a valid ALLEGRO_FONT* and instead get NULL.

Thread #610429. Printed from Allegro.cc