Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » I'm having troubles with linking A5 to CodeBlocks on Windows

This thread is locked; no one can reply to it. rss feed Print
I'm having troubles with linking A5 to CodeBlocks on Windows
Xinomorph
Member #17,927
July 2020

I've made it work before but I remember it also being nightmarish for me last time. And I'm sure I'm doing the same as I did before and I can't make it work.

So, on Windows 10 x64, I installed CodeBlocks. The version on this page that comes with the MinGW compiler.

Then I download the binaries for Allegro 5 from here. I choose the one for the latest version of MinGW on the page that is 4.7. Although I think the CodeBlocks version they provide comes with MinGW 8.1. But the type of error I receive seems more like I just linked it really badly instead of a compatibility error.

What I do is, on CodeBlocks, I go to the project build options:

  • there on the main project tab I go the "Search Directories" tab, and on the "Compiler" sub-tab, I link the entire "include" folder of the Allegro folder. I have also tried linking the "lib" folder on the "Linker" sub-tab there.


  • then I go to the debug and release tab, and on each one of them I go to the "Linker Settings" tab, and link the monolith files there. liballegro-5.0.10-monolith-mt.a for the Release one, and liballegro-5.0.10-monolith-mt-debug.a for the Debug one.

Yet, when I try to compile an allegro project, I get the:

undefined reference to `al_install_system'

undefined reference to `al_destroy_timer'

Etcetera, basically, undefined reference to every single allegro function I use.

Those error messages seem to imply a linking problem, not a compatibility problem between the compiler and the Allegro binaries I downloaded. But I don't know.

Dizzy Egg
Member #10,824
March 2009
avatar

Hello, I do the same as you for "Search Directories", and then under linker settings I have attached the image...

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Xinomorph
Member #17,927
July 2020

Mmm unfortunately I start getting these errors when I do it like that:

cannot find -lallegro_monolith-debug-static
cannot find -ljpeg
cannot find -ldumb
cannot find -lFLAC
cannot find -lfreetype
cannot find -lvorbisfile
cannot find -lvorbis
cannot find -logg
cannot find -lphysfs
cannot find -lpng16

I noticed you didn't add anything in the link libraries section, I've tried both leaving it empty as yours, and adding the monololith library there as I previously had, and at the same time having the same text you have in "other linker options", but I get the same results every time.

Dizzy Egg
Member #10,824
March 2009
avatar

I have this in my linker (search)...

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Xinomorph
Member #17,927
July 2020

Yeah, I have the same, it's the lib folder loaded there. Maybe it's a compatibility issue then, but I don't know, the type of errors I receive sound like I'm linking it wrong. But everything seems to be in its place, so I don't know what I could be doing wrong.

Dizzy Egg
Member #10,824
March 2009
avatar

In your search directories, are you using the absolute or relative path?

(Also make sure you're not putting the .a at the end of your -l options)

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Xinomorph
Member #17,927
July 2020

I tried both, relative and absolute path, and then other linker options (the -l ones), I copied them exactly as you have them.

Dizzy Egg
Member #10,824
March 2009
avatar

Are you using the 64-bit version of Codeblocks? (Mine is 32-bit version)

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Xinomorph
Member #17,927
July 2020

I was using the 64 bit version, I just tried installing the 32 bit version (also the ones that comes with the MinGW) and it's the same. Maybe I should install the compiler separated, I'll try that.

EDIT:

Ok, I made it work. Turns out it was indeed a compatibility issue. I left the same version of Codeblocks I had with the MinGW that came with it. What I changed was the Allegro binaries I used. Instead of using the ones I linked in my first comment, I downloaded the ones from github, this one: allegro-x86_64-w64-mingw32-gcc-10.2.0-posix-seh-dynamic-5.2.7.0.zip

And that combination worked somehow.

Dizzy Egg
Member #10,824
March 2009
avatar

Ahh ok, that's good to know! Glad you got it working.

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Xinomorph
Member #17,927
July 2020

Thanks both of you!

I would recommend that you don't use the MinGW bundled with CodeBlocks.

Your compiler version and the version of the compiler used to build allegro need to match exactly or you will have problems.

I thought about it, but getting that specific MinGW version is an odissey on its own. The latest version of Allegro on github says it's built with "mingw32-gcc-10.2.0", I can't find that version of MinGW. The old official site of the MinGW project in dead, and the new Mingw-w64 site provides an installer where the latest version is 8.1.0 I believe, which is the same one Codeblocks brings with it. Then there is this page: https://osdn.net/projects/mingw/releases which I think it's the official one from the original MinGW project, but I didn't find the 10.2 version, only up to to a 9.2 version. I know I can just download an older version of Allegro there on github though.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Xinomorph
Member #17,927
July 2020

Thanks for your advice! Unfortunately I couldn't find a mingw build in https://winlibs.com/ matching the one SiegeLord used to build the 5.2.7 Allegro 5 version. And about MSYS2, I tried installing it and using it to install mingw but I got way too many errors, and when I googled how to solved them, it was a lot for me; same as building Allegro myself, it's too complicated to me, I'm more of a beginner in this and I feel like I have to learn a lot of previous steps before getting into that. Perhaps it would be easier if SiegeLord provides the specific build of the compiler he used to build the version of Allegro he releases on github... I know it's too much to ask, but considering Allegro is used by lots of beginners that get too lost on these processes, it would help a lot. For now I'm going to stick to trying to match my mingw version with the one used to build the Allegro binaries I download, they are not exactly the same, but close enough.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: