Issue trying to create an event queue in Allegro 5 C++


I'm trying to create an event queue in Allegro using ALLEGRO_EVENT_QUEUE but I get an error of infringement for trying to read a location 0x0000. This is the error message (it's in Spanish): Excepción no controlada en 0x7BE755AF (allegro-5.0.10-monolith-md.dll) en Geometry World.exe: 0xC0000005: Infracción de acceso al leer la ubicación 0x00000000.

These are the includes I have in my code

#include <allegro5/allegro.h>

#include <allegro5/allegro_ttf.h>

#include <allegro5/allegro_font.h>

#include <allegro5/allegro_native_dialog.h>

#include <allegro5/allegro_primitives.h>

#include <allegro5/allegro_image.h>

#include <allegro5/allegro_audio.h>

#include <allegro5/allegro_acodec.h>

This is the code in the line where the error appears.

int main(int argc, char** argv) {ALLEGRO_EVENT_QUEUE* colaEventos = al_create_event_queue();}

Really appreciate any help

asked on Stack Overflow Oct 28, 2020 by CruzSol • edited Oct 28, 2020 by CruzSol

1 Answer


If that single line of code is all the code you have, then the problem here is that you haven't initialised allegro properly.

You have to call al_init(); first, before you can call any other allegro function.

Refer to one of the allegro examples, to see how you should properly set up a event queue.

answered on Stack Overflow Apr 16, 2021 by amarillion

User contributions licensed under CC BY-SA 3.0