Hey Xavier, let me help you out a bit.
First you need to pick a compiler that matches your version of allegro (whether it's for 4 or 5). Second download the binaries. Since you're going with CB and MinGW I suggest you start out with my pre-made binaries from here :
Simply extract the folders anywhere you like. Generally you move the mingw folder to c:\mingw to make it easier for codeblocks and other programs to find your compiler.
Next you need to setup either your command line or your CB project (do not use the global compiler, it just mixes and messes everything up).
First I'll show you how to compile with a simple command line :
Here's a simple list of commands to use with gcc :
-l$NAME where $NAME is libNAME.a,
-g (add in debugging symbols)
-O[0-3] (ie. -O1) optimize from 0 (none) to 3 (lots)
-c output only object files
-Wall turn on all warnings
-Wextra turn on extra warnings
-Werror stop on errors (usually not very helpful)
Anytime you open a command shell, you'll need to set your %PATH% variable to include c:\mingw\bin or wherever you installed MinGW. You can do that with :
The second command will output the current path. You can also change your system environment variable PATH to do the same thing if you want it to be permananent.
In CodeBlocks go to Menu->Project->BuildOptions and click on the overall project button in the top left. Then select search directories and set the compiler and linker search directories to match those of your allegro distribution that you are using (ie. from the binaries I provided, in the \include and \lib folders. You also need to set the linker settings (for the libraries that you need to link to) here :
Compiler Search Directories
Linker Search Directories
After that you'll need to add files to your project by using Menu->Project->Add Files or Menu->File->New File. Then build and run the project as necessary, fixing compiler errors as you go.
There are more advanced things, but those are the basics. I'll see if I can't get this up on the wiki. The page up there for codeblocks and mingw is like 10 years out of date. xD