C++ 快板 5 错误

标签 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;
}

没有语法错误,但是当程序运行时它卡在 al_draw_triangle(10, 10, 20, 10, 25, 50, al_map_rgb(255, 0, 0), 1.0); 功能。下面是控制台和错误消息框的快照。 enter image description here enter image description here

请帮我解决这个问题。

最佳答案

我想您必须调用 al_init_primities_addon()Here您会找到有关此错误的更多信息。

关于C++ 快板 5 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16864923/

相关文章:

c++ - 树莓派上的 "error: stray\255 in program"

c++ - 快板帧率问题

c++ - Ubuntu : undefined reference to `al_install_system' 中的快板

c++ - 快板 5 + MinGW : Audio Addon Not Working

c++ - 如何检测使用 LoadLibraryEx 加载的模块

c++ - 我可以使一个成员函数只能通过另一个类成员函数访问吗?

c++ - 使用 Allegro 库播放任何类型的视频文件的典型示例是什么?

c++ - 无法在 Allegro 中加载字体

c++ - 用于处理用户定义的类型和结构的模板

c++ - 为什么 AddRef 返回零