The Allegro Wiki is migrating to github at

Building Allegro 4.9/Installing 4.9 Windows

From Allegro Wiki
Jump to: navigation, search

by User:MattSmith


To build Allegro 5 and all its add-on libs, you'll need to install the following libs for your compilers. Open a console and make sure the MINGDIR and MSVCDir environment variables are set

zlib and libpng (optional)

zlib is required if want PNG and/or TTF support


 copy zlib1.dll \windows\system32


 copy lib\zdll.exp %MSVCDir%\lib
 copy lib\zdll.lib %MSVCDir%\lib
 copy include\*.h  %MSVCDir%\include


 copy lib/zdll.lib %MINGDIR%\lib
 ren  %MINGDIR%\lib\zdll.lib libz.a
 copy include\*.h  %MINGDIR%\include    

mingw & msvc

Gnuwin32 have good precompiled binaries of libpng 1.2

Download This contains bin/libpng.dll which you copy to \windows\system32

Download which contains both mingw and vc libs

 copy include\* %MSVCDir%\include 
 copy include\* %MINGDIR%\include 
 copy lib\lib*  %MINGDIR%\lib
 copy lib\pkgconfig\libpng.lib %MSVCDir%\lib

freetype (optional)

freetype provides support for the al_ttf & al_font add-ons. Requires zlib.

Gnuwin32 Website :

Download : and run it. Is this supposed to install in the compiler automatically? well it didn't for me. So, in C:\Program Files\GnuWin32

 copy bin\freetype6.dll to \WINDOWS\System32 


 copy -r include\*  %MSVCDir%\include              ft2build.h and freetype dir
 copy lib\freetype.lib %MSVCDir%\include   


 copy -r include\*  %MINGDIR%\include             ft2build.h and freetype dir
 copy lib\libfreetype.dll.a  %MINGDIR%\lib
 copy lib\freetype6.def  %MINGDIR%\lib

d3d9 (optional)

If you build Allegro without this, you will not get the d3d9 graphics driver. You cannot build the DLL without this, as the ABI specifies its presence.




M$ DX SDK Download page:


cmake 2.6

Web page: Download page:



Open a console. Use either the Start-menu VS shortcut or manually run VCVAR32.BAT In your allegro dir, type


to see the list of generators which should include your version of Visual Studio, and then (e.g.)

 cmake -G "Visual Studio 8 2005" -DSTATIC=ON -DSHARED=OFF

use -DSHARED=OFF if you do not have both Open GL and D3D9 libs installed, because they are both needed to build the DLL.

Now you should have 2 workspace/solution files in the root e.g. ALLEGRO.sln and BUILDALL.sln Open your dir in Explorer and open ALLEGRO.sln. This will start VS with all the Allegro libs and examples as projects. Build All. Enjoy the examples.

Now quit and install allegro+plugins for other projects

 copy lib\debug\*.lib %MSVCDir%\lib\ 
 mkdir %MSVCDir%\include\allegro5   
 xcopy include\allegro5\* %MSVCDir%\include\allegro5 /E


 copy addons\acodec\allegro5\acodec.h %MSVCDir%\include\allegro5

Now, write a game