Installing Allegro 5 with Code::Blocks and MinGW
It's been nearly a decade since I've Allegro'd and I'm having some trouble getting things set up again. I have Code::Blocks installed with MinGW. It's compiling simple test programs without errors and they run fine, but I can't get Allegro 5 working.
I followed this tutorial on the wiki but when I tried to compile it gave me a long list of errors, largely saying that the files the tutorial told me to link couldn't be found. I'm not sure what I'm doing wrong or how to get it working right.
Neil, that tutorial is extremely out of date. Let me do you a favor.
Download my MinGW 184.108.40.206 distribution here
Download my Allegro 5.2.2 distribution here
Navigate to the folder where you saved them. Right click on the 7z files and extract them. Right click on the newly created tar files and extract them.
Copy the MinGW folder to C:.
Go into CodeBlocks and make sure it detects your new mingw compiler.
Add the allegro folder's include directory to your compiler search path.
Add the allegro folder's lib directory to your linker search path.
Add the monolith to your linker commands.
Build your project.
Ok, I have a small Allegro 5 program compiling fine, but whenever I try to run it pops up an error message about .dlls missing from my computer. It started with the allegro_monolith-5.2.dll and I copy-pasted that into the program's directory and tried again, then I got four error messages about four other .dlls missing (libFLAC-8.dll, libfreetype-6.dll, libogg-0.dll, and libphysfs.dll). I copy-pasted those into the directory and got errors about another list of dlls, and at that point I figured I must have done something wrong.
Thread #616896. Printed from Allegro.cc
No, you did it right. You really need all those dlls, unless you link statically. That's what the allegro/bin/dlls folder is for. Copy all of them to your executable's directory to run it properly.
Otherwise, static link.
Look in the allegro folder for a file called a5static libraries or something like that. Read it, and use those linker options to link statically to allegro 5 and its dependencies. You don't need to link against stuff you don't use, but you do need to link to stuff allegro uses.