Debug Error
Czar05

Every time I debug my project it fails to appear. An error message pops up and states a "debug error" occurred and gives me the option to either abort or Retry. When I choose to Retry another message pops up telling me "MYPROJECT has triggered a breakpoint". I don't know what this means.

Here are other output errors:

'Ultimate Pong.exe': Loaded 'C:\Documents and Settings\Family\My Documents\Visual Studio 2010\Projects\Ultimate Pong\Debug\Ultimate Pong.exe', Symbols loaded.
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\Allegro\bin\allegro-5.0.5-monolith-md-debug.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.2600.5512_x-ww_dfb54e0c\GdiPlus.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\psapi.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\glu32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\comdlg32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\msvcr100d.dll', Symbols loaded.
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\shimeng.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Unloaded 'C:\WINDOWS\system32\shimeng.dll'
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\d3d9.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\d3d8thk.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\version.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\d3dref9.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\msctf.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\apphelp.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\msctfime.ime', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\mslbui.dll', Cannot find or open the PDB file
'Ultimate Pong.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0xa90) has exited with code 3 (0x3).
The program '[3052] Ultimate Pong.exe: Native' has exited with code 3 (0x3).

Here is my source code:

#SelectExpand
1#include <allegro5\allegro.h> 2#include <allegro5\allegro_primitives.h> 3 4int main() 5{ 6 int player1_x = 50; 7 int player1_y = 400; 8 9 int player2_x = 850; 10 int player2_y = 400; 11 12 int ball_x = 454; 13 int ball_y = 350; 14 int ball_rad = 10; 15 16 bool done = false; 17 18 al_init(); //Initializes the allegro program 19 al_set_new_display_flags(ALLEGRO_WINDOWED); 20 21 al_set_new_display_refresh_rate(60); // The refresh rate for display 22 23 //Makes the display window the width and height 24 ALLEGRO_DISPLAY *display = al_create_display( 900,800); 25 26 // Places "Ultimate Pong" on the window 27 al_set_window_title(display,"Ultimate Pong"); 28 29 ALLEGRO_EVENT_QUEUE *event_queue = NULL; // Creating the event queue 30 event_queue = al_create_event_queue(); 31 // Registers so it can be place keyboard input on the queue 32 33 al_register_event_source(event_queue, al_get_keyboard_event_source()); 34 35 // Initializes primitives 36 al_init_primitives_addon(); 37 38 al_install_keyboard(); // Initializes keyboard device for user input 39 40 while(!done) 41 { 42 43 ALLEGRO_EVENT ev; // Control Events 44 al_wait_for_event(event_queue, &ev); 45 46 if(ev.type == ALLEGRO_KEY_DOWN) 47 { 48 49 switch(ev.keyboard.keycode) 50 { 51 52 case ALLEGRO_KEY_LEFT: 53 player1_y -= 20; 54 break; 55 56 case ALLEGRO_KEY_RIGHT: 57 player1_y += 20; 58 59 } 60 } 61 else if(ev.type == ALLEGRO_KEY_UP) 62 { 63 if(ev.keyboard.keycode == ALLEGRO_KEY_ESCAPE) 64 done = TRUE; 65 } 66 67 68 al_draw_filled_rectangle(player1_x , player1_y, player1_x + 10, player1_y - 100, al_map_rgb(99,99,100)); // Paddle number 1 69 70 al_draw_filled_rectangle(player2_x, player2_y, player2_x + 10, player2_y,al_map_rgb(99,99,100)); // Paddle number 2 71 72 // Ball 73 al_draw_filled_circle(ball_x, ball_y, ball_rad,al_map_rgb(250,0,0)); 74 75// Helps what has been drawn visible on screen. Switches from blank screen to the actually image 76 al_flip_display(); 77 78 al_clear_to_color(al_map_rgb(0,0,0)); 79 80 } 81 82 al_destroy_event_queue(event_queue); 83 al_destroy_display(display); // Destroys the display 84 return 0; 85}

I need help understanding what the problem is.

Matthew Leverton

You need to install the keyboard before you use it.

Czar05

I placed the al_install_keyboard after the display. The primitives appear (thanks), but the program is not accepting any input. Any ideas.

#include <allegro5\allegro.h>
#include <allegro5\allegro_primitives.h>

int main()
{
int player1_x = 50;
int player1_y = 400;

int player2_x = 850;
int player2_y = 400;

int ball_x = 454;
int ball_y = 350;
int ball_rad = 10;

bool done = false;

//Initializes the allegro program
al_init();
al_set_new_display_flags(ALLEGRO_WINDOWED);
al_set_new_display_refresh_rate(60); // The refresh rate for display

//Makes the display window the width and height
ALLEGRO_DISPLAY *display = al_create_display( 900,800);

// Places "Ultimate Pong" on the window
al_set_window_title(display,"Ultimate Pong");

// Initializes keyboard device for user input
al_install_keyboard();

// Creating the event queue
event_queue = al_create_event_queue();

ALLEGRO_EVENT_QUEUE *event_queue = NULL;


// Registers so it can be place keyboard input on the queue
al_register_event_source(event_queue, al_get_keyboard_event_source());


// Initializes primitives
al_init_primitives_addon();

while(!done)
{

ALLEGRO_EVENT ev;
al_wait_for_event(event_queue, &ev);

if(ev.type == ALLEGRO_KEY_DOWN)
{

switch(ev.keyboard.keycode)
{

case ALLEGRO_KEY_LEFT:
player1_y -= 20;
break;

case ALLEGRO_KEY_RIGHT:
player1_y += 20;

}
}
else if(ev.type == ALLEGRO_KEY_UP)
{
if(ev.keyboard.keycode == ALLEGRO_KEY_ESCAPE)
done = true;
}

// Paddle number 1
al_draw_filled_rectangle(player1_x , player1_y, player1_x + 10, player1_y - 100, al_map_rgb(99,99,100));

// Paddle number 2
al_draw_filled_rectangle(player2_x, player2_y, player2_x + 10, player2_y,al_map_rgb(99,99,100));

// Ball
al_draw_filled_circle(ball_x, ball_y, ball_rad,al_map_rgb(250,0,0));

// Helps what has been drawn visible on screen. Switches from blank screen to the actually image
al_flip_display(); /
al_clear_to_color(al_map_rgb(0,0,0));

}

al_destroy_event_queue(event_queue);
al_destroy_display(display); // Destroys the display
return 0;
}

Matthew Leverton

Use tags to format your code when posting. Click the formatting help button for the syntax.

ev.type needs to be ALLEGRO_EVENT_KEY_DOWN.

You are using ALLEGRO_KEY_DOWN which is just a constant that represents a keycode for the "down" key.

Thread #609346. Printed from Allegro.cc