简体   繁体   English

C ++在Visual Studio 2015中使用Allegro5 al_init_image_addon()错误

[英]C++ using Allegro5 in Visual Studio 2015 al_init_image_addon() error

I'm trying to start using allegro5 with C++. 我正在尝试开始将Allegro5与C ++一起使用。 I copied the first code from a tutorial just to see if it'll work and here it is: 我复制了教程中的第一个代码,只是看它是否可以工作,这里是:

#include <allegro5/allegro.h>
#include <allegro5/allegro_font.h>
int main()
{
    al_init();
    al_install_keyboard();
    al_init_image_addon();
    ALLEGRO_KEYBOARD_STATE klawiatura;
    ALLEGRO_DISPLAY *okno = al_create_display(320, 240);
    al_set_window_title(okno, "Allegro5 kurs pierwsze okno");
    ALLEGRO_BITMAP *obrazek = al_load_bitmap("widok.png");
    while (!al_key_down(&klawiatura, ALLEGRO_KEY_ESCAPE))
    {
        al_get_keyboard_state(&klawiatura);
        al_clear_to_color(al_map_rgb(0, 255, 0));
        al_draw_bitmap(obrazek, 0, 0, 0);
        al_flip_display();
    }
    al_destroy_display(okno);
    al_destroy_bitmap(obrazek);
    al_rest(5.0);
    return 0;
    }

I keep getting the error 我不断收到错误

C861 identifier "al_init_image_addon" is undefined

Is there some kind of a new version of this command? 该命令是否有某种新版本?

al_init_image_addon is defined in allegro_image.h . al_init_image_addonallegro_image.h定义。 Add the following: 添加以下内容:

#include <allegro5/allegro_image.h>

So, you didn't make it as a final answer. 因此,您并没有将其作为最终答案。 Check if you imported the allegro image header. 检查是否导入了allegro图像标题。

#include <allegro5/allegro_image.h>

In case you have Allegro with Visual Studio, you have to check the option Image addon in the next path: Project properties -> Allegro 5 -> Image Addon. 如果您将Allegro与Visual Studio结合使用,则必须在下一个路径中选中选项Image addon:项目属性-> Allegro 5-> Image Addon。 Is a checkbox. 是一个复选框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM