Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » No matter what I do I can't get allegro working.

This thread is locked; no one can reply to it. rss feed Print
No matter what I do I can't get allegro working.
XulTee
Member #16,086
September 2015

Ok so let me start at the beginning.

I am doing a honors project and I decided to use Allegro 5 to give my c++ program some fancy 2d graphics. So I say to myself, "This should be easy I'll just zip on over to the website and download it and it will be ready to go!"

What I didn't realize is that OMG it is a pain in the butt. So first I attempted to get allegro 5 working with xcode. After about 4 hours of gitcloning and brew installing and attempting to link libraries I have gotten nowhere. I admit I am new to using anything other than the standard c++ library.

I did find this 3 year old video https://www.youtube.com/watch?v=IZ2krJ8Ls2A and so I jumped on my PC with windows and began following the tutorial with my CodeBlocks. Except even after following it I run into problems, my bin folder not having any .lib files for example. So after a grand total 10 hours of wasted time I am nowhere. So my question to this lovely community is as follows.

Are there ANY tutorials for complete and utter beginners to get allegro 5 working on either xcode mac environment or CodeBlocks windows environment?

I have found so so so many wiki's and such but they all seem to assume so knowledge that I don't have. So I am very frustrated and seeking help.

Chris Katko
Member #1,881
January 2002
avatar

Did you start on Linux? because that's very simple. I just did it a few days ago on my laptop and it took ~5 minutes.

- Download Allegro 5.
- Extract tar file.
- Open directory in terminal
- type "cmake ."
- make
- sudo make install

Done, assuming you have all the dependencies already installed. If not, you basically look at the error when it stops and install that package until there are no missing packages.

You should then be able to run examples. Getting a basic "load and draw sprites and respond to keyboard input" is really simple.

[edit]

XulTee said:

xcode mac

Oh, I don't know Mac specifics.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Karadoc ~~
Member #2,749
September 2002
avatar

I don't use a mac, so I can't offer much advice other than to check this link. The instructions there are generally pretty good.

That said, I'd also like to add that I understand your frustration. I've spent a lot of time trying to get various programming things to work. In some sense I find it fascinating just how difficult it is. There just seems to be no end to the number of things that can go wrong. It's not just allegro. It's pretty much library, and any IDE... there's always a stack of things that can go wrong.

Every so often I decide I'm going to upgrade all my programming tools, or install stuff on a different computer. Sometimes it goes very smoothly, and everything is up and running in a hour or so; but other times it takes days of work to iron out the problems. It's amazing. Sometimes it's missing dependencies; or dependencies installed in an unexpected way; or things have changed their names or version numbers or directory structures; or some kind of conflict between files with similar names or functions; or depreciated functions of an old library; or ...

well like I said, there seems to be an endless list of things that can go wrong. All I can really say is read that guide, and goodluck!

-----------

Chris Katko
Member #1,881
January 2002
avatar

That said, I'd also like to add that I understand your frustration. I've spent a lot of time trying to get various programming things to work. In some sense I find it fascinating just how difficult it is. There just seems to be no end to the number of things that can go wrong. It's not just allegro. It's pretty much library, and any IDE... there's always a stack of things that can go wrong.

That's a good point. I want to say I share in that frustration. XulTee, don't give up!

I've had countless hours of frustration with various getting software packages to install or work. Not to mention hardware/OS/driver failures. I beat my head against the wall for half a day last week and all I wanted to do was: Load a wave file, edit the values, save and play that wave file. Every Python package was huge, had tons of dependencies, broken things to fix and all I wanted to do was touch a dang wave file.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Polybios
Member #12,293
October 2010

You can certainly install Allegro 5 via homebrew on OS X. I don't know much about XCode, sorry.

On Windows, it's probably easiest to install via msys2 and its package manager, although there aren't any tutorials on that right now.

Regardless of the environment you use, you basically need to be sure of two things:

  1. your compiler must be able to find the include files (.h) which you have to include

  2. you need to link your program with the library files (.lib / .a + .dylib / .dll / .so; varies per platform) and your linker needs to be able to find them

While you typically include the headers directly from your code, you need to specify the library files somewhere on the commandline / in a makefile or in your IDE. Using code blocks, it can be found under "Project build options", "Linker settings", "Link libraries", I think.
With a GNU / gcc type of compiler, you don't specify the exact filename but what comes after lib..., so to link to Allegro 5, you pass -lallegro to the compiler on the command line or enter allegro somewhere in your IDE. If you want to use any of the addons you need to link extra libraries (allegro_font, allegro_image and so on) On OS X, you'll also need allegro_main.

Typically, there's some directory structure on your system where your compiler will look for include and library files. If you copy / install them there, it's gonna find it. ^^
Just be sure to pick the right version for your compiler on Windows - or install via msys2.

Go to: