ERROR: R6010

Started by
0 comments, last by alvaro 12 years ago
[font=Verdana, sans-serif]I created a simple program in in C++ and allegro in Visual C++ 2010 Express.[/font]

[font=Verdana, sans-serif]It works fine; I get no compiler errors. BUT, when I try to run the program I get a Message Box that says:[/font]
[font=Verdana, sans-serif](Window Caption) "Microsoft Visual C++ Debug Library"[/font]
[font=Verdana, sans-serif](error) "Debug Error![/font]
[font=Verdana, sans-serif]Program: ...e\Desktop\programming\c++\visual\2010\BlockZ\Debug\BlockZ.exe[/font]

[font=Verdana, sans-serif]R6010[/font]
[font=Verdana, sans-serif]- abort() has been called[/font]

[font=Verdana, sans-serif](Press Retry to debug the application)"[/font]

[font=Verdana, sans-serif]That's what it says![/font]

[font=Verdana, sans-serif]HERE'S MY CODE:[/font]
[font=Verdana, sans-serif]

#include <allegro.h>

int main()
{
allegro_init();
install_keyboard();
set_color_depth(16);
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);

BITMAP* buffer = create_bitmap(640, 480);

BITMAP* bg = load_bitmap("bg.bmp", NULL);

while(!key[KEY_ESC])
{
blit(bg, buffer, 0, 0, 0, 0, 640, 480);
blit(buffer, screen, 0, 0, 0, 0, 640, 480);
}

destroy_bitmap(buffer);
destroy_bitmap(bg);

return 0;
}
END_OF_MAIN();
[/font]
Advertisement
If you step through your program using the debugger you'll get a much better idea of what's going on.

You should check the return values of every function that can possibly fail. I suspect load_bitmap is failing (for instance your program my not be running with the correct setting for current directory), it is returning NULL and then you are using an invalid pointer in blit.

This topic is closed to new replies.

Advertisement