December 09, 2018, 02:01:00 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
   Home   Blogs Help Search Tags Login Register  
Pages: [1]   Go Down
Author Topic: Installing Allegro in Visual C++ 2008 Express  (Read 9253 times)
0 Members and 1 Guest are viewing this topic.
Richard Marks

Respect: 3425
Offline Offline

Posts: 1027


« on: April 07, 2010, 02:54:02 PM »

Installing Allegro in Visual C++ 2008 Express

This short tutorial will step you through installing Allegro version 4.2.2 for use with Microsoft Visual C++ 2008 Express Edition. (MSVC9)

First, click here and download Allegro Version 4.2.2 pre-compiled binary for Microsoft Visual C++ 2008 Express.

This is Allegro version 4.2.2 pre-compiled and ready for use with Visual C++ 2008 Express.
I use this version and not the latest version because I found this version to be more stable IMHO.
If you want the latest version, then this tutorial isn't for you.

Step 1 - Installation of the Library Files

Extract the files from the file to a place on your hard drive.
I recommend that you place all your third-party libraries in a directory called Libraries, and preferably off your home folder or hard drive root.

So if you are on Vista, this is C:\Users\username\Libraries\
On XP, this is C:\Libraries\

Extract the files, and you should have:


Where LibraryPath is the path to the Libraries directory I just told you to create.

Step 2 - Telling Visual C++ Where to Find the Library Files

Open Visual C++ 2008 Express, and click the Tools menu, then choose Options.
Click VC++ Directories on the left side under Projects and Solutions.
On the right side, under the Show directories for: label, change the drop-down box to Include files.
Click the New Line button (folder with a starshine) and then click the ellipses button (...) and browse to the include directory for Allegro that we just installed.
Repeat the procedure for the library files in the drop-down and choose the lib folder.

Step 3 - Adding the Allegro DLL to the PATH

This process varies for the OS. So if you don't know how to edit the PATH for your computer, google "How to change PATH environment setting in {Your Operating System Here}" and add the bin directory from the Allegro installation to your PATH environment variable.

Step 4 - Test the Installation

Choose File -> New Project
Choose Win32 Project
Enter "AllegroTest" for the Name
Click OK
Click Application Settings
Check the Empty Project check-box
Click Finish

Add a main.cpp file to your project, and in the file, add this code:
#include <allegro.h>
#pragma comment(lib, "alleg.lib")

int main(int argc, char* argv[])
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0);
BITMAP* backBuffer = create_bitmap(SCREEN_W, SCREEN_H);
const int WHITE = makecol(255, 255, 255);
textprintf_ex(backBuffer, font, 8, 32, WHITE, -1, "Hello World!");
blit(backBuffer, screen, 0, 0, 0, 0, backBuffer->w, backBuffer->h);
return 0;

Compile the project and run it.
If nothing fails, you're done. If you've got any errors, post them here and I'll help you sort it out.

Thanks for reading.

Tags: Allegro msvc9 visual studio 2008 express c++ visual c++ installing allegro 
Pages: [1]   Go Up
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!