|
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:
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
|
Hello, I do the same as you for "Search Directories", and then under linker settings I have attached the image...
---------------------------------------------------- |
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 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
|
I have this in my linker (search)...
---------------------------------------------------- |
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
|
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)
---------------------------------------------------- |
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
|
Are you using the 64-bit version of Codeblocks? (Mine is 32-bit version)
---------------------------------------------------- |
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
|
Ahh ok, that's good to know! Glad you got it working.
---------------------------------------------------- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
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. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Xinomorph
Member #17,927
July 2020
|
Thanks both of you! Edgar Reynaldo said: 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
|
You can get MinGW-W64 from installing it inside MSYS2 using it's pac-man package installer. That's how SiegeLord makes them. You can also get MinGW-W64 builds from https://winlibs.com/ and then build Allegro and the dependencies yourself if you want a different compiler. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
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
|
You're welcome to use my unofficial binaries. You can find them here : https://github.com/EdgarReynaldo/EagleGUI/releases/tag/0pt8pt2alpha The compiler from winlibs is linked, and there are binaries for Eagle 0.8.2 and Allegro 5.2.7.1 My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|