ACES
Computer Science
Development Environment: MinGW + Code::Blocks + Allegro
Monday, July 10, 2006
This is a how-to document on installing and configuring a build environment with an IDE for Allegro. The following instructions are tailored for WinXP.
Installing and configuring MinGW
- Download the latest MinGW installer: http://prdownloads.sourceforge.net/mingw/MinGW-5.0.2.exe?download
- Run the installer, select the mirror closest to your location, and select Download as needed and install.
- Select "Current" on the next screen and hit next.
- Run a full installation. (A few selections are not necessary on this screen, but I tend to use everything so I select it all). Ada, Java, Objective C, and g77 may not be needed for your particular use.
- On the next screen, make the path be default (C:\MinGW) and accept the rest of the prompts until the install is finished.
- Open the System Environment Variables by hitting <Windows Key> + Pause/Break, select the Advanced tab, and hitting the Environment Variables button.
- Once the Env. Vars open up, add a new user environment variable named MINGDIR. Make the value be the same as you picked for step "e". In this case it would be C:\MinGW. (You will also have to add C:\MinGW\bin to the PATH to make the compiler to work)
- Goto the command prompt and type gcc -v to test the installation. If it outputs version information associated with your version of compiler, you are ready to go onto the next stage.
Installing and compiling Allegro
- Download the latest version of Allegro: http://prdownloads.sourceforge.net/alleg/all420.zip?download and unzip this file into the main directory of your MinGW installation. (C:\MinGW)
- Download the DirectX 7 SDK http://alleg.sourceforge.net/files/dx70_mgw.zip or the DirectX 8 SDK http://alleg.sourceforge.net/files/dx80_mgw.zip and extract it into the main directory of your MinGW installation (C:\MinGW).
- Open a command prompt and cd to your Allegro directory (C:\MinGW\allegro)
- Run cmd> fix.bat mingw32 from this directory
- Run cmd> mingw32-make (it may be easier to rename C:\MinGW\bin\mingw32-make.exe to make.exe and substitute throughout this document)
- (If you want to static link, you will have to build allegro to do that): Run cmd> mingw32-make STATICLINK=1
- Finally run cmd> mingw32-make install
- If it did not output errors, you are ready to go onto the next stage.
Installing Code::Blocks, the IDE
- It is recommended to get a nightly build from here: http://forums.codeblocks.org/index.php?board=20.0
- This document is based on the July 10th, 2006 build: http://forums.codeblocks.org/index.php?topic=3515.0
- You will need three things: the unicode http://download.berlios.de/codeblocks/wxmsw26u_gcc_cb_wx2.6.3p2.7z ; the ansi http://download.berlios.de/codeblocks/wxmsw26_gcc_cb.7z ; and the IDE files http://download.berlios.de/codeblocks/CB_20060710_rev2729_win32.7z
- Extract these to C:\CodeBlocks or the folder of your choice with 7-zip http://www.7-zip.org/
- Right-click on the executable and create a shortcut to the desktop.
- Run the shortcut and verify that it works.
Allegro Templates
- Download the file attachment and extract into the %APPDATA%/codeblocks/UserTemplates directory.
- To use the static linking capability of Allegro, choose the User Template "Allegro Static Link".
- To use the default dynamic linking (the application needs the allegro dll) capability of Allegro, choose the User Template "Allegro Dynamic Link".
- The templates only include the linking information, so you will need to add/write source files.
- Just to check, try this sample code (as shown in the Allegro documentation):
#include <allegro.h>
int main()
{
allegro_init();
allegro_message("Hello World!");
return 0;
}
END_OF_MAIN()
int main()
{
allegro_init();
allegro_message("Hello World!");
return 0;
}
END_OF_MAIN()
