Allegro Debug -Abort() Has Been Called

Asked

Viewed 137 times

2

I tried to make an animation and Visual Studio gives the error Debug -Abort() Has Been Called.

Code:

#include <allegro5\allegro.h>
#include <allegro5\allegro_native_dialog.h>
#include <allegro5/allegro_image.h>

const int WIDTH = 1000;
const int HEIGHT = 600;
bool exit = false;

const int maxFrame = 12;
int curFrame = 0;
int frameCount = 0;
int frameDelay = 5;


int main()
{
    ALLEGRO_DISPLAY *display = NULL;
    ALLEGRO_EVENT_QUEUE *event_queue = NULL;
    ALLEGRO_TIMER *timer;
    ALLEGRO_BITMAP *image[maxFrame];

    if(!al_init())
    {
        return -1;
    }

    display = al_create_display(WIDTH, HEIGHT);

    if(!display)
    {
        return -1;
    }

    al_install_keyboard;
    al_init_image_addon;

    image[0] = al_load_bitmap("walking w0000.bmp");
    image[1] = al_load_bitmap("walking w0001.bmp");
    image[2] = al_load_bitmap("walking w0002.bmp");
    image[3] = al_load_bitmap("walking w0003.bmp");
    image[4] = al_load_bitmap("walking w0004.bmp");
    image[5] = al_load_bitmap("walking w0005.bmp");
    image[6] = al_load_bitmap("walking w0006.bmp");
    image[7] = al_load_bitmap("walking w0007.bmp");
    image[8] = al_load_bitmap("walking w0008.bmp");
    image[9] = al_load_bitmap("walking w0009.bmp");
    image[10] = al_load_bitmap("walking w0010.bmp");
    image[11] = al_load_bitmap("walking w0011.bmp");

    for(int i = 0; i < maxFrame; i++)
    {
        al_convert_mask_to_alpha(image[i], al_map_rgb(106, 76, 48));
    }

    event_queue = al_create_event_queue();
    timer = al_create_timer(1.0 / 60);

    al_register_event_source(event_queue, al_get_timer_event_source(timer));
    al_register_event_source(event_queue, al_get_keyboard_event_source());

    al_start_timer(timer);

    while(!exit)
    {
        ALLEGRO_EVENT ev;
        al_wait_for_event(event_queue, &ev);

        if(ev.type == ALLEGRO_EVENT_KEY_DOWN)
        {
            switch(ev.keyboard.keycode)
            {
            case ALLEGRO_KEY_ESCAPE:
                exit = true;
                break;
            case ALLEGRO_KEY_LEFT:

                break;
            case ALLEGRO_KEY_RIGHT:

                break;
            case ALLEGRO_KEY_UP:

                break;
            case ALLEGRO_KEY_DOWN:

                break;
            }
        }
        else if(ev.type == ALLEGRO_EVENT_TIMER)
        {
            if(++frameCount >= frameDelay)
            {
                if(++curFrame >= maxFrame)
                {
                    curFrame = 0;
                }
                frameCount = 0;
            }
        }

        al_draw_bitmap(image[curFrame], 200, 100, 0);

        al_flip_display();
        al_clear_to_color(al_map_rgb(0, 0, 0)); 

    }

    for(int i = 0; i < maxFrame; i++)
    {
        al_destroy_bitmap(image[i]);
    }
    al_destroy_event_queue(event_queue);
    al_destroy_display(display);

    return 0;
}

Complete error:

'Sobrevivencia.exe': Loaded 'C:\Users\Lucas-PC\Desktop\Arquivos\Sobrevivencia\Debug\Sobrevivencia.exe', Symbols loaded.
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\allegro-5.0.10-monolith-md-debug.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\psapi.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.9600.17415_none_dad8722c5bcc2d8f\GdiPlus.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\comdlg32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\combase.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\winmmbase.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9600.17810_none_7c5b6194aa0716f1\comctl32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\SHCore.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\d3d9.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\aticfx32.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\atiu9pag.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Unloaded 'C:\Windows\SysWOW64\atiu9pag.dll'
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\atiu9pag.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\atiumdag.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\atiumdva.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Program Files (x86)\Internet Download Manager\idmmkb.dll', Cannot find or open the PDB file
'Sobrevivencia.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
Sobrevivencia.exe has triggered a breakpoint
The thread 'Win32 Thread' (0x14c0) has exited with code 3 (0x3).
The thread 'Win32 Thread' (0xcfc) has exited with code 3 (0x3).
The thread 'Win32 Thread' (0x17e0) has exited with code 3 (0x3).
The thread 'Win32 Thread' (0x140c) has exited with code 3 (0x3).
The thread 'Win32 Thread' (0x804) has exited with code 3 (0x3).
The program '[4472] Sobrevivencia.exe: Native' has exited with code 3 (0x3).
  • The messages Cannot find or open the PDB file probably not important. The part that matters I think is from the Sobrevivencia.exe has triggered a breakpoint.

  • Imagine what it might be ??

  • I don’t know. Maybe someone who knows comes here...

1 answer

2

The first error is in the inclusion of the Allegro 5 files:

#include <allegro5\allegro.h>
#include <allegro5\allegro_native_dialog.h>
#include <allegro5/allegro_image.h>

You are mistakenly using ' to include the first two files. Use '/' instead of ' when referring to files. (If you want to know why, basically ' ' is a special character in C and C++ that performs several operations with strings, so it is avoided.)

Your second error is in the lack of startup of the Addons you included. Always, at all times that will make any program with Allegro 5, initialize your files. In case the files that need initialization are the allegro.h and the allegro_image.h. To initialize the allegro.h, put at the beginning of the program the following macro:

int main() {
     al_init();

To initialize allegro_image. h, put after the al_init() the following function:

     al_init_image_addon();

The last error of your program refers to the lack of reference to Allegro 5 and its Dlls in Visual Studio. To resolve this issue, right-click your Visual Studio project, go to properties, then select Configuration Properties>>Linker>>Input, and in the field "Additional Dependencies" enter the name of your current library (in case I assume you want it to be a debug version of the library), ie: "Allegro-5.x. x-Monolith-Md-debug.lib" (Replace "x.x" with your version of Allegro 5. Mine for example is 5.0.10).

Editing: Another serious mistake you made was:

al_install_keyboard;
al_init_image_addon;

You forgot to add parentheses after the function names. The compiler will find that you are wanting to say something else by simply putting the function name in the code. The correct way is:

al_install_keyboard();
al_init_image_addon();

Fixed these errors, it is almost certain that your program will work.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.