I have found a couple of people on www.gamedev.net having trouble installing Allegro in/using Visual C++ 2008 “Orcas” and since for some reason I have found an easy way of installing it I’ve decided to showcase a small article on how I installed the Allegro-4.2.2 library and having it accessible in Visual C++ 2008.
First the link to the Allegro-4.2.2 library can be found here Allegro-4.2.2 . Now let’s get through some easy quick instructions.
Installing Allegro-4.2.2 correctly on your system
- Unrar the folder Place this in a safe folder that you know won’t get deleted, or shifted around
- Start up Visual C++ 2008
- Direct yourself to Tools > Options
- Under Options > Projects and Solutions > VC++ Directories
- Direct yourself to “Show Directories for:” in the combo box look for inlcude
- Create new line click on the browse button and direct yourself to the allegro-4.2.2 \include directory
- direct yourself to “Show Directories for:” and look for lib
- Create new line click on the browse button and direct yourself to the allegro-4.2.2 \lib folder
Linking up Allegro-4.2.2 in Visual C++ 2008 & First Project
- Create New Visual C++ 08 Empty Project
- In solution Explorer right click on source folder Add New Item
- Add new .CPP file name it main
- Go to Project Properties > Configuration Properties > Linker > Input
- In Additional Dependecies add “alleg.lib”
- Copy and paste given source
#include <allegro.h>
int main(void)
{
allegro_init();
set_gfx_mode(GFX_SAFE, 640, 480, 0, 0);
install_keyboard();
//input for players positions
while(!key[KEY_ESC])
textout_ex(screen, font, "Allegro-4.2.2 working in Visual C++ 2008", 1, 12, 11, -1);
//end program
allegro_exit();
return 0;
}
END_OF_MAIN()
Now Build and Run and you should have a window much like the image below.

Hope this helped!
Just a small mention to Allegro
Allegro is a game library supporting C/C++ distributed freely and their main site is Allegro Site where the library, documentation, source files, and much much more can be viewed, downloaded freely! Thank you for making and keeping Allegro a free game programming library!
Tags: allegro, allegro-4.2.2 visual C++, coding. game development, gaming, programming
May 23, 2008 at 2:13 am |
ok so i followed your steps but i coudnt find linker
under project>properties>….. pleaqse help
May 23, 2008 at 5:14 am |
My bad. While you are in your project solution. (i.e. you have a project opened)
Go to Project > Project Properties.
From their you’ll see a tree list on the left side. Click on
Configuration Properties.
Linker > Input
Sorry I was sorta rushing through this.
I’ve added you on my IM account under coden4fun, so if I see you online I will mention that I have indeed updated this with a comment, and have answered your question to the best of my knowledge.
Good Luck!
September 4, 2008 at 6:39 pm |
so i finally got allegro up and running in msvc 2008 express.
so far so good. i used to use dev-cpp but most programming is on msvc so im trying to get rid of an extra ide i dont need.
now. you have to set up the linker input for EVERY new allegro project. any tips on a project wizard?
September 5, 2008 at 12:29 am |
You can make a template for your game in Visual C++ and for now even though I’m sure it’s not the preferred way in the game development community that is how I setup all of my games.
So, let’s say I have a game template that has basic input, sound, visual effects, etc… and each of these classes I’ve just created can easily be used for Pacman, Tetris, Pong, Break-Out, etc… I create a Visual Studio C++ Template of all of those classes, and set that project up with the Allegro library, and BAM! I have a Visual C++ Template in Visual Studio that I can easily use for other games, which will save me much time on programming.
Read this article from the MSDN
website (http://msdn.microsoft.com/en-us/magazine/cc188697.aspx)
Hopefully that will explain in details precisely how to do exactly what you would like to do.
Thanks for reading the blog!
September 20, 2009 at 5:46 pm |
Hey csfinch
This guide has been very helpful. But as Cecil pointed out, VC++ users have to set up the project every time. Do you know of any project to template converters? Or if you have a template that would work in VC++, could you please share?
September 5, 2008 at 8:50 am |
it seems that article is for exporting web, c#, and VB, item and project templates. msvc++ has no “export template” feature. not sure exactly how to go about doing it
October 9, 2008 at 11:02 am |
Sorry bud, everything works just fine excepting your code. The first line looks a bit strange with no include file. Even after adding a proper file declaration your code doesnt work. I have managed to run allegro and build the code that works properly (found it somewhere else), but it seems like there is an error in yours.
October 9, 2008 at 6:58 pm |
Thanks for pointing that out. I have copied and pasted the latest code from my running test project for Allegro in Visual Studio 2008. The code that is now up works if you follow the directions carefully.
Sorry for the inconvenience.
December 5, 2008 at 8:13 pm |
I compile the code given and get a link error that it cannot open alleg.lib, any thoughts on why?
March 3, 2009 at 5:49 pm |
OK, the link is no longer there, and I have found people here are having a difficult time understanding the lib process. I’m going to rewrite this blog for you’ll, and post it on dreamincode.net!
Meridthcn, you compiling the code and getting a linker error is most possibly not adding the lib files needed in the project from allegro correctly, or simply applying that you need those to your project.
Whichever it is, I’ll give each of you’ll an email when the tutorial is on the other website, and I will most definitely make sure everything compiles correctly once you follow the instructions verbatim.
May 16, 2009 at 12:44 am |
Thanks for the guide this worked great! been having troubles doing this for a while and this worked quick!
May 20, 2009 at 2:20 pm |
hello I’m trying to do a static link for allegro in vc2008 … how can I do that ?
June 4, 2009 at 8:06 am |
I followed your setup guide exactly, but when I copy pasted your program it is telling me that it skips #include and that all of the commands are not found.
June 8, 2009 at 3:42 pm |
Thank you. I followed your steps from the “Linking up Allegro-4.2.2 in Visual C++ 2008 & First Project” section and it worked perfectly.
In case you are curious, I did not follow the first section since I just copied the files into the compiler’s bin, lib, and include directories.
Thanks again.
July 6, 2009 at 6:47 pm |
Ok – I’ve followed your instructions, and I didn’t get any compiler errors. However when I test the .exe from the debug folder – I get the following error: “This application has failed to start because alleg42.dll was not found. Re-installing the application may fix this problem.”
July 24, 2009 at 1:05 am |
Also when you start this you will have to copy paste the .dll files into your project debug folder for it to compile right
August 21, 2009 at 6:40 pm |
sweet deal man, saved my ass a lot of time, haha. thanks!
November 9, 2009 at 2:50 pm |
Hey great mini tutorial. Tried for ages to get allegro to work with vs8 chanced across your blog and did it in minutes. Much appreciated. ta
December 6, 2009 at 7:58 am |
The code fails to Build. I get this error:
Error 1 fatal error C1083: Cannot open include file: ‘pc.h’: No such file or directory c:\allegro\include\allegro\platform\aldjgpp.h 20
What can I do?
December 17, 2009 at 4:58 pm |
я считаю: превосходно!
December 17, 2009 at 10:20 pm |
I ended up having to put some of the allegro dll’s in the project folder to get this to work
December 18, 2009 at 3:33 am |
THANK YOU MAAAAAN!!!
Finally!
I had a problem, but I solved it copying the files from the folder ‘bin’ to the ‘Debug’ folder [The final one, where the user can find the compiled exe].
(the files are 3 dlls)
January 25, 2010 at 12:57 am |
hey i was wondering how do i put a picture in my projects i tried putting it near the .exe maybe im doing it wrong but can you put up a tutorial for it?
January 31, 2010 at 8:52 am |
http://www.talula.demon.co.uk/allegro/wip.html
Download the above link this is for allegro game programming library
this above link doesnt have libraries and dll files.
dont worry
here is the link u will find
http://www.megaupload.com/?d=1JQ8OTWU
Download above link this link contains all libraries for allegro and also dll files in it.
copy and paste it
the following steps to install allegro
1.Unrar the folder Place this in a safe folder that you know won’t get deleted, or shifted around
2.Start up Visual C++ 2008
3.Direct yourself to Tools > Options
Under Options > Projects and Solutions > VC++ Directories
4.Direct yourself to “Show Directories for:” in the combo box look for inlcude
5.Create new line click on the browse button and direct yourself to the allegro-4.2.2 \include directory
6.direct yourself to “Show Directories for:” and look for lib
7.Create new line click on the browse button and direct yourself to the allegro-4.2.2 \lib folder
8.Create New Visual C++ 08 Empty Project
9.In solution Explorer right click on source folder Add New Item
10.Add new .CPP file name it “main.cpp”
11.In property manager tab where u can find at the bottom after solution explorer tab –Go to Project Properties > Configuration Properties > Linker > Input
12.In Additional Dependecies add “alleg.lib”
Copy and paste given source
#include
int main(void)
{
allegro_init();
set_gfx_mode(GFX_SAFE, 640, 480, 0, 0);
install_keyboard();
//input for players positions
while(!key[KEY_ESC])
textout_ex(screen, font, “Allegro-4.2.2 working in Visual C++ 2008″, 1, 12, 11, -1);
//end program
allegro_exit();
return 0;
}
END_OF_MAIN()
March 22, 2010 at 6:22 am |
>LINK : fatal error LNK1104: cannot open file ‘MSVCRTD.lib’ i have got dis error….i follow all your instruction…help please!!
April 16, 2010 at 6:17 pm |
hi, I’ve got it linked and the test code i’ve got works…however, when i put in other code in the main, then all it asks for is to “Press any key to continue” and then exits the program…none of my code gets run, not even the Allegro code. If i only put my functions in and leave the Allegro code, it runs. As soon as i try to use something like “cout” it doesnt work…
What do i do?
Thanks…
April 23, 2010 at 8:22 pm |
Hey, thanks for the guide. The code compiled fine but when I ran it I got this: “The program can’t start because alleg42.dll is missing from your computer. Try reinstalling the program to fix this problem.” I then copied the contents of bin to the Debug folder (Projects\projectName\Debug) and it worked (though for some reason I couldn’t close the window :/ Had to wait till it didn’t respond to close it) …Just thought I’d leave that here in case someone else gets the same error.
May 3, 2010 at 12:50 am |
OK, thanks for the tutorial
May 3, 2010 at 1:10 am |
Well, it’s been 2 years since I’ve written this, and it seems people are still commenting on this post, so I’ll leave it up. I’m going to do a revision and post it soon, so those who have a link error (in the future, for I’m sure those who had one has figured it out or have moved on) will have no trouble if they read and follow instructions verbatim.
Thank you all for reading my post and thanking me for writing it. It truly has surprised me.
I also want to personally thank Boddu Avinash for correcting my download and supplying the readers with all files needed.