Windows, Visual Studio 2008 and Allegro 5

From Allegro Wiki
Jump to: navigation, search

Configuring Microsoft Visual Studio 2008 for Allegro 5.0.0

Before you can configure VS 2008, you will need to install Allegro. I used the prebuilt binaries for 5.0.0RC4 for this. For installation instructions for the windows prebuilt binaries, go link here. I had thought about uploading pictures of each step, but I decided not to at this time. If this is something that others would like me to do I can add those pictures at a later time.

Create a New Project

Click File, New, Project and select Win32 Project. If you want the console window to be present for standard output choose Win32 Console Application. Otherwise, choose Win32 Project. When the new project Wizard continues, click Next and check the box for Empty Project, then click Finish.

Decisions

If you plan to use all of the addons, the Monolithic libraries are the best way to go here and will save you a lot of time. If, however, you only plan to use one or two addons, like fonts and images, the monolithic libraries are overkill.

Next you have to decide if you will use the static or dll versions. See the above install guide for more information. You also need to decide if you are going to use the MT versions or the MD versions. Again, see the above install guide for more information. For this tutorial, I will be using the static MT versions of the library. This provides the fewest number of DLLs which need to be distributed with the finished program. I will also only be using the image, primitives, and font addons.

Setting up the Win32 Debug Properties

The active profile should be Win32 Debug. Click on Project, Properties, and the properties dialog will pop up. Make sure that the active profile is set to Win32 Debug.

C/C++ Settings

Under C/C++, Click Preprocessor and add ALLEGRO_STATICLINK to Preprocessor Definitions

Under Code Generation, change Runtime Library to Multi-threaded Debug (/MTd)


Linker Settings

In Linker Settings, go to General, Input, and add the following to the Additional Dependencies, leaving the checkmark next to Inherit Properties:

allegro_primitives-5.0.0-RC4-static-mt-debug.lib

allegro_image-5.0.0-RC4-static-mt-debug.lib

allegro_ttf-5.0.0-RC4-static-mt-debug.lib

allegro_font-5.0.0-RC4-static-mt-debug.lib

freetype-2.4.4-static-mt-debug.lib

allegro-5.0.0-RC4-static-mt-debug.lib

opengl32.lib

gdiplus.lib

winmm.lib

psapi.lib



Setting up the Win32 Release Properties

The active profile should be Win32 Debug. Click on Project, Properties, and the properties dialog will pop up. Select Win32 Release as the profile to change.

C/C++ Settings


Under C/C++, Click Preprocessor and add ALLEGRO_STATICLINK to Preprocessor Definitions

Under Code Generation, change Runtime Library to Multi-threaded (/MT)


Linker Settings

In Linker Settings, go to General, Input, and add the following to the Additional Dependencies, leaving the checkmark next to Inherit Properties:

allegro_primitives-5.0.0-RC4-static-mt.lib

allegro_image-5.0.0-RC4-static-mt.lib

allegro_ttf-5.0.0-RC4-static-mt.lib

allegro_font-5.0.0-RC4-static-mt.lib

freetype-2.4.4-static-mt.lib

allegro-5.0.0-RC4-static-mt.lib

opengl32.lib

gdiplus.lib

winmm.lib

psapi.lib


Notes: Using other addons or the Monolithic libraries

Every addon will add other dependencies, which will need to be added to the linker settings. For example, to use the audio addon you would need to add allegro_audio*.lib allegro_acodec*.lib, dumb*.lib, libflac*.lib, libogg*.lib, vorbis*.lib, and vorbisfile*.lib, replacing the * with the appropriate mt static and debug options you want to use. To use the physfs addon you will need to include the physfs.h file, physfs*.lib, allegro_physfs*.lib, and zlib*.lib.

For the Monolithic libraries you need all of those lib files to be added to Additional Dependencies.


I hope this helps anyone just starting out with Allegro 5 and VS 2008.


WG