Installing Allegro 5 with Code::Blocks and MinGW problems

Hello, I'm completely new to allegro, and I have tried every tutorial for installing it I found through the internet, but none seems to work for me. I use Windows 7, 64 bit, Code Blocks 10.5 and I'm trying to install Allegro 5.

My latest hope was the one I found on this thread:

I follow every instruction as it is written, have no problems whatsoever during the installation, even when I build the example program there's no warning. However, when I try run the example, I get:

Assertion failed: dm.dmFields & 0x00100000, file C:\CodeBlocks\allegro\src\win\wsystem.c, line 361

And Windows closes the program.

From what I've found on the net, this is due to the assertion on the wsystem file in line 361 being false, but I never modified it, so I don't get this problem at all.
I've searched the forums for a similar problem without success, so I'm writing here, hoping anyone can help me, because I really want to use allegro, but it's like my 5th failed installation method.
Also, if the thread I was following does not work, please tell me so I can try another way, and If anyone knows the best, with the smallest chance of error method to install allegro with my specs, please tell me.

Thanks for the attention and I hope someone can help me solve this.

Edgar Reynaldo

Line 361 of src/win/wsystem.c from 5.0.0rc4 is :

   ASSERT(dm.dmFields & DM_PELSHEIGHT);

So DM_PELSHEIGHT is not set, and that is why it fails the assertion.

5.0.0rc4 is pretty old by now, and you should be using a more current version. 5.0.5 just came out.


Have you tried the one in the Wiki?.


Actually I did, otherwise I wouldn't come here to ask, but I guess it doesn't hurt to try again, when I used the tutorial from the wiki I had a strange problem:

Everything compiled OK, but when I ran the program I got the normal black console window I get when compiling any C program, and another window I couldn't see, but it was in the taskbar, and I could see the preview window from windows 7, and there was the program running, but I can't actually see it, just the preview-thing in the taskbar... I don't know if I made myself clear, if not tell me.

Does anyone know if this can be fixed, or did I install something wrong?

Edgar Reynaldo

Sounds like you've been bit by the window position bug - just set the window position manually after creating the display :

ALLEGRO_DISPLAY* display = al_create_display(800,600);
al_set_window_position(0,0);// in case al_set_new_window_position doesn't work


Edgar Reynaldo, thank you so much! It worked!
I was really looking forward to using allegro, and I just couldn't get it to work, but now I'll finally start having fun with it, thanks!

Edgar Reynaldo

No problem.

If you want to center the window, use al_get_monitor_info.

al_get_monitor_info(ALLEGRO_DEFAULT_DISPLAY_ADAPTER , &i);
int monwidth = i.x2 - i.x1;// + 1?
int monheight = i.y2 - i.y1;// + 1?
al_set_new_display_position((monwidth - windowwidth)/2 , (monheight - windowheight)/2);
ALLEGRO_DISPLAY* display = al_create_display(windowwidth , windowheight);

Thread #608763. Printed from