Guide to Install 5.1 on C::B
Jabroni

Could someone point me to a step by step guide to installing Allegro 5.1 on C::B? I tried it on my last pc and messed up really badly. I found a lot about installing 5.0 but I can't figure out how to install 5.1 and I'd really like to have access to the features in 5.1.

Okay, so, thanks to the help from several people on this thread, this is how far I've come so far.

I followed the instructions at https://amcerasoli.com/allegro/article/10 but ran into a couple of issues on the last step, namely executing mingw32-make in C:\allegro-ready. I was getting problems related to DirectX and the solution was to download the directX version from http://alleg.sourceforge.net/files/dx9mgw.zip. What I did was merge and overwrite these files, then I also extracted the zip to C:\dx9mgw and altered CMake in the following ways:

- FREETYPE > FREETYPE_INCLUDE_DIR_ft2build : C:/mingw/include/freetype2
- FREETYPE > FREETYPE_LIBRARY : C:/mingw/bin/lib/libfreetype.a
- D3DX9 > D3DX9_LIBRARY : C:/dx9mgw/lib/libd3dx9.a

================

Now I just need to know how to get this into C::B

Johan Halmén

I'm just about to do that, too. I've installed A5.1 from source, together with a lot of other stuff, according to AMCerasoli's guide. So far all the A5.1 stuff seems to have compiled ok, all the examples and demos seem to work.

Then I downloaded C::B from a Win exe installer, without the compiler, since I installed that earlier. C::B found MinGW and set it to the default compiler.

My next step is to set up one or two template projects for A5.1. If no one has a step by step guide for that, I might have a look at some of the examples and demos. Checking their makefiles might tell me how to build the templates.

What's so different in installing 5.0?

pkrcel

Basically nothing I would say, if for INSTALLING you don't mean compiling from source.

Johan Halmén

As I said, I followed the guide in this link. Basically it was like this:

  1. Download and install MinGW compiler

  2. Download the source of A5.1

  3. Try to compile and build it, only to find out that you need a lot of other packages (audio, images, compression, video etc)

  4. Download each other package from source and compile/build it

  5. Copy the bin, include and lib stuff from what you just built, into the bin, include and lib directories of MinGW

  6. Repeat from #4, until you think you have what you need

  7. Try once again to build A5.1

And that's how far I am right now. Oh yes, I also have a working C::B. But as pkrcel pointed out, you might not want to build Allegro using C::B. I should have all libs, includes and bins ready. I only need to link and include them to my C::B projects.

AmnesiA

Thank you so much for the link to that guide! Updated OP with my progress so far.

Edgar Reynaldo

You need the DirectX from alleg.sourceforge.net, here it is :
dx9mgw.zip

AmnesiA

Alright, I'm just going to update the OP with the steps that I took to overcome some of the problems.

My question is now, what do I do now that I've done everything in that guide? I just ran "C:\allegro-ready\mingw32-make install" and it completed so what do I do next to make programs using allegro in Code::Blocks? I remember I had to update linker tools for 5.0 but I haven't done that yet for 5.1

Johan Halmén

I'm following this guide this very moment...
...shouldn't be that different from A5.1.

...Darn! I have no static libraries there. Must have missed some flag somewhere, when I built Allegro. Guess I still can make dynamically linked applications.

...I haven't found any missing flag. Don't know why I can't build static libs. But I found this package: https://www.allegro.cc/forums/thread/613773/995477#target

...I ran the Cmake thing once again on Allegro. This time I seem to have managed to get the static libs, too. :D

AmnesiA

I followed that same guide and it seemed to work for me. Make sure you go over the part about CMAKE and allegro in the first guide, that's where they had the check boxes for static linking and also notice that one of the file names was changed because of the static linking (ZLIB_LIBRARY : libzlibstatic.a)

So far so good.

Johan Halmén

I seem to be able to compile and run simple things inside C::B. A console window opens in the back, an Allegro graphic window opens in the front. It stays open for 5 seconds (al_rest(5.0)), but then when everything closes, Windows complains about a crashed program and the console window shows a return value of 255, not 0 that I put in my code. The C::B build log says "Process terminated with status 255 (0 minute(s), 16 second(s))".

Still something wrong somewhere. If I just paste all code from some of the Allegro examples, it runs just fine with return code 0. But with my own code it crashes at exit and returns 255 or something else.

Arthur Kalliokoski

Windows complains about a crashed program and the console window shows a return value of 255, not 0

Does it say something about "abnormal program termination"? If so, it's not your return code, but some other error.

Johan Halmén

Yes, I get that, because I return 0 in the code, but the console window gets something else. And Windows complains about the crashed app.

pkrcel

Do you handle any event in the example code?

Johan Halmén

Here's my code. As I said, it seems to work ok, until it closes.

#SelectExpand
1#include "allegro5/allegro.h" 2#include "allegro5/allegro_font.h" 3#include "allegro5/allegro_ttf.h" 4#include "allegro5/allegro_image.h" 5#include "allegro5/allegro_primitives.h" 6#include "allegro5/allegro_native_dialog.h" 7 8int main(int argc, char **argv) 9{ 10 al_init(); 11 12 ALLEGRO_DISPLAY *display; 13 display = al_create_display(800, 600); 14 15 al_rest(5.0); 16 17 al_destroy_display(display); 18 al_uninstall_system(); 19 return 0; 20}

AmnesiA

I don't think you need al_uninstall_system() if you use al_init() instead of al_install_system()

Johan Halmén

No, I dont. I guess the problem in my program is that it doesn't do anything. I threw in some lines that drew some primitives there, then I flipped the display. After that it finished without crashing. Could it be that you have to flip at least once before ending your application?

It also seems that creating a display will give you a white window, but flipping the first time will reveal a black window.

Anyway, now I guess I have everything set for coding in Code::Blocks.

AmnesiA

It might be. I think until you flip the display once it just shows garbage, I could be wrong about that but I think I remember making a program and my desktop showed up on the display until it flipped.

pkrcel

Could it be that you have to flip at least once before ending your application?

Ah yes, there should be another thread with something like this somewhere...though time finding it :P

Johan Halmén

Jabroni, please don't edit your original post. Write instead new posts. If you still have problems, I might be able to help, because I've just got it right, I think. I have a working installation of MinGW, I have a separate installation of Code::Blocks (not the version that comes with MinGW integrated, not that it probably matters) and I have the allegro-ready folder correctly built up with working exe files in the examples folder. And I have a working project in C::B with all static libs needed and all include paths needed.

Well, so far everything works. I haven't tested each and every add on library with corresponding function calls.

AmnesiA

edited the original post so if anyone has the same problem in the future they don't have to read through all the replies to find the solution. the problem's soved, that's why i edited it. i'll log on my other account and give credit when i get back home

Johan Halmén

Well, you got me confused. I never noticed you had two accounts. That's a bad thing and usually enough reason for being banned. Anyway, this was a good thread. Got me thinking loud and getting things done. Back to coding. I actually found a 2 year old thread I started about a game idea I had, something that could be my first A5 project. Picking it up again.

Thread #614383. Printed from Allegro.cc