The Allegro Wiki is migrating to github at


From Allegro Wiki
Jump to: navigation, search

Code::Blocks Information

Code::Blocks is a free and cross platform C++ IDE built to meet the most demanding needs of its users. It is designed to be very extensible and fully configurable.

It is available at

Nightly builds >>

And here you find a allegro wizard for c::b nightly build.

Setting up Allegro for Code::Blocks with MinGW on Windows XP/Vista

STEP 1 - Installing the MinGW Compiler

In order To use Allegro a C or C++ compiler is required, which the MinGW compiler has been chosen. You can download it from here. Obviously, use the .exe installer for windows.

Run the application and step through the installer, but make sure you have the following selected:





(image upload is currently not working on the Allegro wiki)

Environment Variables

The final part of the installation involves environment variables.

XP: Click on start, then control panel, then the system icon. Click on the advanced tab and then on the environment variables button. Under 'system variables' click new.

Vista: Click start, right click Computer, select properties. On the left side of the new window select "advanced system settings". Then on the newest window press Environment Variables.

Two variables will need to be added:

1) MINGDIR and the path value of C:\mingw (assuming that's what you called the directory where you installed mingw).

2) PATH with the path value C:\mingw\bin. Note that Path may already exist and will then need to be edited/modified.

Note: Any changes to environment variables will not affect currently opened console windows. You will need to restart the console for the changes to take effect.


Open a console (START->run, type in cmd and click OK) change the directory to C:\mingw or to wherever you installed MinGW and type in gcc -v.

You should see something like this :-

Console picture.png

Assuming you get output looking something like this, the compiler is installed properly. If not, something went wrong. Follow the previous steps again or contact the forums with the details.

STEP 2 - Installing The Allegro Library

The 4.2.2 Stable Version

First download the source from here

Once you've got that unzip it in C:\allegro. (or any other location)

Next, you need to download a directX package. This is because the Windows version of allegro uses directX (the standard Windows way of interfacing graphics). Allegro won't compile without it.

Download here.

Extract the contents to C:\mingw overwriting all files.

Open a console again. Get to C:\allegro.

Now allegro can be compiled by typing in the command line:

> FIX.BAT mingw
> MINGW32-MAKE.EXE install

STEP 3 - Installing Code::Blocks

This guide uses the stable release of Code::Blocks. This can be found here

Follow the Windows 2000/XP/Vista link.

Download it to the Desktop and then click on the icon to install it.

When Code:Blocks opens, click Settings->Compiler and debugger... and click on the Toolchain Executables. This should like this :-


If that's how it looks you should be ready to start compiling allegro programs.

Windows Vista users will also have to add the following to the 'additional paths' tab: C:\MinGW\libexec\gcc\mingw32\3.4.5

Compiling an Allegro Program

Create a new folder on the C: drive for storing your projects.

For an example, start a new project by clicking on Create a new project on the Code::Blocks opening screen (or File->New-.Project). Choose console application and then click on GO.

A wizard should open. Choose C for the language. On the next page choose a name for the project (perhaps 'test'). Where it says 'Folder to create project in' click the button to the right and browse to the folder made for projects Click next and then tick the box next to Create Release Configuration. Click next.

Write yourself a little allegro program or look at the included examples with the allegro source under C:\allegro\examples, and add it to the project sources.

Once you've done that, right click the project icon and select Build options. On the window that appears click on the Linker settings tab. Click the Add button. Navigate to the Allegro Library file, which should be C:\allegro\lib\mingw32\liballeg.a and press OK.

Errors or Issues

These should be brought to the forum as to help in issue resolving.