I am trying to learn some allegro 5 principles with youtube tutorials and here is my first problem .
#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;
}
There are no sytnax errors but when the program works it gets stuck on the al_draw_triangle(10, 10, 20, 10, 25, 50, al_map_rgb(255, 0, 0), 1.0);
function . Here are the snapshots of the console and the error message box .
Please help me to fix this problem .
I suppose that you've got to call al_init_primities_addon()
. Here you find more informaton about this error.