Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Help with Code Blocks, Allegro 5 and MinGW

This thread is locked; no one can reply to it. rss feed Print
Help with Code Blocks, Allegro 5 and MinGW
Michael Weiss
Member #223
April 2000

I have used Allegro for years, all the way back to DOS DJGPP and RHIDE.

Most recently my tool chain includes:
Dev-Cpp
MingW
Allegro 4.4.2
libnet
DUMB
zlib

I just released a new version of my game I have been working years:
https://www.allegro.cc/depot/PurpleMartians/

Now I want to start using Allegro 5 and Code::Blocks

I am looking through the install guides and trying to follow them
but I have a few questions.

https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5

I am told repeatedly here that:
Please note that you MUST install the matching compiler version with the version used to compile the Allegro libraries

However both links on this guide for MinGW just go to blank pages.

When I installed Code::Blocks, the version I downloaded came with MinGW
and gcc 5.1.0

The Allegro binaries I found all seem to be built with later versions of gcc
5.2.4.0 (gcc 7.2)
5.2.2.0 (gcc 6.2)
5.2.1.0 (gcc 5.3)

The MinGW website appears to not have been updated for a few years.
I looked at Mingw-w64, that seems to be active...

Am I barking up the wrong tree here?

Does anyone have any advice or can tell me how they do it?

Is there a better way than the way I am attempting?

I don't know anything about Code::Blocks, besides what I have read
on the internet, but it seems like something I would like to use.

I was perfectly happy with Dev-Cpp and its DevPaks, but it seems
to be getting old and not updated for a while, and I thought
I'd like to try something new.

As far as compilers go, I have no interest in any MSVC or anything
microsoft.

Any advice or pointers would be greatly appreciated...

Edgar Reynaldo
Member #8,592
May 2007
avatar

Vanilla MinGW is going the way of the dodo.

MinGW-W64 is the way to go. The official binaries are made with MinGW-W64 now. Pick up the matching compiler and the dependencies and you're good to go.

Allegro 5.2.4 release thread :
https://www.allegro.cc/forums/thread/617292

Binaries for Allegro
https://github.com/liballeg/allegro5/releases

Allegro dependencies
https://github.com/liballeg/allegro_winpkg/releases

MinGW-W64
https://sourceforge.net/projects/mingw-w64/files/

Michael Weiss
Member #223
April 2000

Thanks, I'll try that.

Edgar Reynaldo
Member #8,592
May 2007
avatar

Michael Weiss
Member #223
April 2000

Can't find libwebp-7.dll

These are the steps I followed:

installed mingw-w64
7.2.0
i686
posix
dwarf
rev 1

installed code::blocks-17.12

in global compiler settings for GCC ->
toolchain executable -> compilers install dir:
C:\Program Files (x86)\mingw-w64\i686-7.2.0-posix-dwarf-rt_v5-rev1\mingw32

in project build options -> search directories for compiler
added:
C:\Program Files (x86)\allegro-i686-w64-mingw32-gcc-7.2.0-posix-dwarf-dynamic-5.2.4.0\allegro\include

in project build options -> search directories for linker
added:
C:\Program Files (x86)\allegro-i686-w64-mingw32-gcc-7.2.0-posix-dwarf-dynamic-5.2.4.0\allegro\lib

in project build options -> linker settings added:
C:\Program Files (x86)\allegro-i686-w64-mingw32-gcc-7.2.0-posix-dwarf-dynamic-5.2.4.0\allegro\lib\liballegro_monolith.dll.a;

This test program compiles and links successfully:

#include <stdio.h>
#include <allegro5/allegro.h>

int main(int argc, char **argv){

ALLEGRO_DISPLAY *display = NULL;

if(!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}

display = al_create_display(640, 480);
if(!display) {
fprintf(stderr, "failed to create display!\n");
return -1;
}

al_clear_to_color(al_map_rgb(0,0,0));

al_flip_display();

al_rest(10.0);

al_destroy_display(display);

return 0;
}

But when I try to run the program...

missing allegro_monolith-5.2.dll
found and copied to same dir as exe...

missing libwinpthread-1.dll
found and copied to same dir as exe...

missing libwebp-7.dll
can't find this anywhere...

Am I missing something? In all of the mingw and allegro folders
I cannot find this file.

I also downloaded the dependencies, but it isn't there also
allegro_deps-i686-w64-mingw32-gcc-7.2.0-posix-dwarf-1.7.0

Also does anyone have any advice on a sensible directory structure?

I downloaded both the static and dynamic versions of allegro and
would like to experiment with both.

Should I keep them in their own directories?

Should the dependencies be kept in their own directory?

Are the dependencies only for the static version?

What about the compiler? In its own directory too?

Does it make sense to have the dll's somewhere in PATH
so I don't have to always copy them to the exe dir?

Please, if anyone has any advice on a sensible directory
structure for development, let me know.

Also please help me figure out what I'm doing wrong to get
libwebp-7.dll misssing.

Thanks

SiegeLord
Member #7,827
October 2006
avatar

Get the 5.2.4.1, it fixes the accidetal libwebp dependency.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Michael Weiss
Member #223
April 2000

Thanks, I can run it now!

Still if anyone has any advice on a sensible directory structure,
please let me know...

Thanks

Edgar Reynaldo
Member #8,592
May 2007
avatar

Neil Roy
Member #2,229
April 2002

This version of Allegro 5 is probably the easiest to compile yourself. I recommend grabbing MinGW-W64 7.2, CMake and compiling it yourself. If I could do it (and this is the first I was able to) anyone can. ;) Just use the GUI version of CMake to do it.

I posted any problems I had and solutions in the original release thread.

Go to: