C++ Allegro 5错误

sam*_*024 0 c++ allegro allegro5

我试图用youtube教程学习一些allegro 5原则,这是我的第一个问题.

#include<allegro5/allegro.h> 
#include<allegro5/allegro_native_dialog.h> 
#include<allegro5/allegro_primitives.h>
#include<Windows.h>

#define ScreenWidth 800 
#define ScreenHeight 600

int main()
{
    ALLEGRO_DISPLAY *display; 

    if(!al_init())
    {
        al_show_native_message_box(NULL, NULL,  "Error" ,  "Could not initialize Allegro 5" , NULL, ALLEGRO_MESSAGEBOX_ERROR); 
        return -1;
    }
    display = al_create_display(ScreenWidth, ScreenHeight); 

    if(!display)
    {
        al_show_native_message_box(NULL, NULL,  "Error" ,  "Could not create Allegro 5 display" , NULL, ALLEGRO_MESSAGEBOX_ERROR);
        return -1;
    }

    al_set_new_display_flags(ALLEGRO_NOFRAME);
    al_set_window_position(display, 200, 100);
    al_set_window_title(display,  "CodingMadeEasy" );


    system("pause");
    al_draw_triangle(10, 10, 20, 10, 25, 50, al_map_rgb(255, 0, 0), 1.0);
    system("pause");


    al_flip_display();
    al_rest(5.0);
    al_destroy_display(display);

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

没有sytnax错误但是当程序工作时它会卡在al_draw_triangle(10, 10, 20, 10, 25, 50, al_map_rgb(255, 0, 0), 1.0);函数上.以下是控制台和错误消息框的快照. 在此输入图像描述 在此输入图像描述

请帮我解决这个问题.

vla*_*fau 6

我想你必须打电话al_init_primities_addon().在这里您可以找到有关此错误的更多信息.