callegro

Allegro error in DevC++


I am running the latest DevC++ 5.5.3 and I need to use the Allegro 5.0.4 so I downloaded it from devpaks and install it common way. But when I want to run the project with allegro the compiler show me error "allegro.h: No such file or directory". I was looking for the answer but I haven't found the relevant one. And what more I have to use DevC++.

#include <stdio.h>
#include <allegro.h>
int main(void)
{
    allegro_init();
    allegro_message("Hello World");
    return 0;
}
END_OF_MAIN()

Linker is set to -lalleg


Solution

  • Allegro 5 is not backward compatible with Allegro 4. It is a brand new library made by the same people.

    Your code snippet is for Allegro 4.

    The equivalent is:

    #include <allegro5/allegro.h>
    #include <allegro5/allegro_native_dialog.h>
    
    int main(void)
    {
        al_init();
        // al_init_native_dialog_addon(); // Introduced in 5.0.9
        al_show_native_message_box( /* fill in params */ );
    
        return 0;
    }
    

    You would need to link against the main Allegro library along with the native dialogs library.