Allegro 5.0.7 on Code::Blocks

i have spent the last 3 weeks and countless hours trying to get allegro to work on codeblocks, ive read nearly every other 'help' discussion i can find, and none of them work for some unknown reason, so i thought i might give it one last shot before moving on and make my own post showing what problems im having. so i am using:

codeblocks 10.05
MinGW 4.6.2
and allegro 5.0.7
and my OS is windows 7 64bit

now i have had many diffent problems with this library, but last nightit seemed i finally managed to get it working, (so i thought) i could only get the #include files to work, nothing else. so when i got on today i kept getting a error every time i built and ran my program, (which again is just #include files) here is the error

"C:\MinGW\msys\1.0\src\mingwrt\..\mingw\main.c|73|undefined reference to `WinMain@16'| "

a little google'ing told me that it was an error compiling the program, like trying to make a GUI on a console application. (thats how i understood it)

anyway i have some pictures i took of my project build options and other various errors i received during this process. ive already spent alot of time on the wiki and tried installing it following that and that is how i actually got it close to working last night. anyway here are the pictures, any and all help is appreciated, if i left any key details out please let me know what it is and ill be happy to correct myself. also if wasting all my time setting up allegro to potentially not even work is there a different library out there that isn't as much of a pain as this to set up and that works well that i should get? ive been looking into SFML.

i would like to note really quick that ive sense change the directory of 'pic 4' from the file i made of the static library's to the actual file they are in.
Last edited on
try and make your main line this
int main(int argc, char** argv)

Usually when i get a undefined reference like that, that fixes it. Also you might of forgot to link in the 'allegro_main.lib' or whatever file?
ok thank you ill give that a shot. here are the #include's i have in my program:

#include <iostream>

#include "allegro5/allegro.h"
#include "allegro5/allegro_font.h"
#include "allegro5/allegro_ttf.h"
#include "allegro5/allegro_image.h"
#include "allegro5/allegro_primitives.h"

i believe the #include "allegro5/allegro.h" counts as the allegro main, i was on the manual page allegro has and i tried both and they dont work together it says something about it redefining itself. unless you mean in the linker options, but in the linker i used every file in the order the wiki stated.
Noo i ment the library
See how include the regular allegro library AND the allegro_main?
oh ok i see now. let me see if i even have that, thank you ill go look for it now and link it
i dont have an allegro_main.a or any variation of that, im not sure if its because the differnce in our operating systems im not sure, but you're running some version of IOS and im on windows 7 perhaps the allegro downloads have different .a files for them. but here is a picture of all my 'liballegro-version' files
can you post your code please?
i dont have any code in the program its just the #include files, i couldent get any of the code i tryed to work, and the code i tryed was just al_init and a few other lines of the super super basic allegro code on their website.
well just make a basic skeleton then
#include <iostream>

#include <allegro5/allegro5.h>

int main(int argc, char** argv)
    ALLEGRO_Display* Display;

    Display = al_create_display(640, 480);

    return 0;


If all goes right then you might see a quick flash lol
Last edited on
thank you thats literally the most clear and lengthy code i can find of allegro5 lol. but it didnt work, here are the errors i got:
ALLEGRO_Display was not declared in this scope| |error: 'Display' was not declared in this scope|
am i missing something in the build options maybe? or in the properties? should it be a GUI application or something else? i can link pictures of all my build options and properties if that will make it easier.

also it didnt say anything about this in the wiki's but in the build options under seach directories>linker should there be any files in there? i know under compiler you link the allegro include folder.
Whoops :P
change it to

And yes in the linker you should link in the libraries - thats probably why you're getting all those errors
Last edited on
oh that code worked now a window open flashed white then closed. i didn't add anything in the search directories>linker yet, so ill do that now, thanks so much man! i guess i did have almost everything working just was using the wrong allegro code or improper syntax haha.
Oh well if it worked then you dont have to add anything into the linkers i guess :P

Goto for the official site with games using allegro 5 and forums n stuff :)
tremendous! man thank you soooooo much!
Topic archived. No new replies allowed.