• ### Announcements

GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Followers 0

# Allegro in CodeBlocks using MinGW - compiler/library version mismatch?

## 5 posts in this topic

A couple of nights ago I downloaded CodeBlocks, in the latest of many doomed attempts to resume programming since I dabbled a few years ago. Doomed, unfortunately, because I never seem to be able to get an IDE working with a library. This time I thought I'd ask for help, so with any luck the next problem I have will be one I've written myself. ;)

I downloaded CodeBlocks, and Allegro (5.0.10), and also MinGW (4.8.1) separately, and following this gloriously straightforward article - http://www.buildandgun.com/2013/09/creating-codeblocks-project-and-linking.html - to the best of my ability. So the code I have is the code on that page, saved as a .cpp file. But when I try to build and run it, I get the following:

||=== Build: Debug in Template (compiler: GNU GCC Compiler) ===|
..\..\Libraries\allegro-5.0.10-mingw-4.7.0\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp|| undefined reference to _Unwind_Resume'|
..\..\Libraries\allegro-5.0.10-mingw-4.7.0\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp|| undefined reference to _Unwind_Resume'|
..\..\Libraries\allegro-5.0.10-mingw-4.7.0\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp:(.eh_frame+0x63)||undefined reference to __gxx_personality_v0'|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|

Now, I did try googling the key words from this (undefined reference to unwind resume/gxx personality), but I found the results to almost entirely impenetrable. As best I can figure, there's a mismatch between the version of MinGW that Allegro is expecting (4.7.0) and the version I have (4.8.1). But this is the newest version of Allegro, barring "potentially unstable" experimental builds.

Am I understanding the problem correctly?

Should I try to find the matching older version of MinGW and download that instead (and would I need to uninstall the current one)?

Or should I try one of the unstable builds of Allegro in the hopes that it might have caught up with the compiler version (though this cmake business always confuses me)?

0

##### Share on other sites

Unwind_resume is something from the exception handling in C++. Looks like the stdc++ library gets not linked. But .....

ld is no recursive linker. If you have the following commandline

<object files> -lstdc++ -lallegro

and liballegro needs functions from stdc++ they are missed.

<object files> -lallegro -lstdc++

will solve this. or

<object files> --start-group -lstdc++ -lallegro --end-group

For the libraries between --start-group and --end-group ld works like a recursive linker.

0

##### Share on other sites

I don't know but maybe you it works better if you follow the instructions on the official wiki.

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

That page is outdated as it states the latest version of MinGW as 4.7.0.  There is no official binary for the latest version of MinGW.  Dynamic linking will not help either, as the problem is that the binaries are for a different version of MinGW.

Should I try to find the matching older version of MinGW and download that instead (and would I need to uninstall the current one)? Or should I try one of the unstable builds of Allegro in the hopes that it might have caught up with the compiler version (though this cmake business always confuses me)?

If you do decide to install the older version of MinGW to match the binaries you have then yes, you will need to uninstall the version you have now. The unstable (development) versions of Allegro do not come in a binary format, so you will have to build them yourself from source - you could also build the stable version from source as well so that it does match your MinGW version.

Building from source is not particularly difficult, but can take a while as you will need to download the tools (cmake, git etc) if you don't already have them and you will first need to build the dependencies. There is a complete guide to the process here.

1

##### Share on other sites

When I wrote that short tutorial I was using MinGW 4.8.1 myself; this shouldn't be the problem.

The obvious answer I could give you would be to download the Allegro binaries for MinGW 4.8.1, but I checked and they don't exist (these are community maintained, can't really complain).

The second obvious answer is telling you to compile Allegro 5.0.10 on your own instead of getting the binaries. Unfortunately Allegro is not an easy to build library, on the contrary, it takes a lot of time, needs some specific DirectX files and other libraries, a pain; go to this link if you want to give this a try.

Now, what you could really do is:

1 - Try adding the -fexceptions option to your compiler flags (right before pkg-config --cflags --libs allegro-5.0 allegro_primitives-5.0` ), it's worth a try.

2 - Go to the www.allegro.cc forums and ask if anyone has the binaries for 4.8.1. The only time I had gone there for help they were really helpful.

Just as a side note, both Allegro and MinGW have new versions, MinGW is on 4.9.0 while Allegro has its 5.1 out (with a new API). I'd recommend going with both new versions even though they are considered unstable.

1

##### Share on other sites

For the benefit of anyone having the same problem and finding this via Google, after an enormously helpful exchange with the wonderful (and superhumanly patient) dejaime, we seem to have tracked down the source of this problem in this particular case: Code::Blocks was still using the version of MinGW that came bundled with it rather than the one I'd downloaded separately. Making sure it was pointing it at the latter instead fixed the problem.

Settings > Compiler... > Toolchain executables, and change "Compiler's installation directory" to the location of the separately-installed compiler's folder (in my case C:\MinGW rather than something under Code:Blocks' own folders).

Many thanks for the replies!

Edited by Lyrisath
0

## Create an account

Register a new account