Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » How do I get and install Allegro?

Credits go to amarillion, LennyLen, and Marco Radaelli for helping out!
This thread is locked; no one can reply to it. rss feed Print
How do I get and install Allegro?
coolmangroupof4
Member #8,580
April 2007

I'm hoping someone can help me. Allegro looks cool, and I want it. The problem is I have no clue what I need (compilers, Allegro files),and how to install Allegro. I'm hoping someone can help.

LennyLen
Member #5,313
December 2004
avatar

A good place to start is here.

For compilers, if you're running Windows, either MSVC or MinGW.

edit:

I just noticed that the installation guide for MinGW (Dev-CPP) is missing. The easiest way to install Allegro is to download one of the precompiled binaries, since it means you don't have to compile the library yourself.

The precompiled binaries can be found here. The same page also has the documentation, as well as other tools and examples, so make sure to grab them all.

amarillion
Member #940
January 2001
avatar

It's easy. You'll need a C/C++ programming environment. If you're beginning, I recommend devcpp (devcpp makes use of the mingw compiler, but it also has a development environment and is a bit easier to set up)

Then head over to http://alleg.sourceforge.net/ There you can download the allegro library itself. Download the latest stable version, then unpack it. Then you have to compile it. This can be tricky, but don't give up after your first try. Try to read any docs you can find, and we'll be happy to answer any specific questions here.

Marco Radaelli
Member #3,028
December 2002
avatar

If you are on Windows go get MingW (choose "MinGW-3.1.0-1.exe", it's old but will self-install, later you can just download each package and unpack it to the directory where you installed the first package).

Then download Allegro from here, unpack it somewhere on your disk and follow the instructions in /docs/build/mingw32.txt (if something goes wrong you may need some other packages listed in the Allegro download page).

[edit] I'm really slow o_O

coolmangroupof4
Member #8,580
April 2007

Thanks! I instlaed MinGW, and Put the entire Allegro library in the minGW folder. Just one question:Can I run a sample program to make sure everything works and how?

LennyLen
Member #5,313
December 2004
avatar

Quote:

Thanks! I instlaed MinGW, and Put the entire Allegro library in the minGW folder.

When you say "the entire Allegro library" did you mean the precompiled version I recommended, or the sources from sourceforge that the others did? If you downloaded the source, you actually need to compile it, not just copy it to the MinGW directory.

Quote:

Can I run a sample program to make sure everything works and how?

There's no program that you can just run to test that the library has installed properly. You need to write some test code and make sure it compiles.

BAF
Member #2,981
December 2002
avatar

I'd recommend Code::Blocks or MSVC Express over devcpp, because devcpp isn't in development anymore.

coolmangroupof4
Member #8,580
April 2007

In reply to LennyLen's question, I downloaded the binary files(MinGW and tools .zip files.)

One last question: When I create a code, how do I compile it.(I'm using the C language.)

Kibiz0r
Member #6,203
September 2005
avatar

Why's everyone complicating this...

Just get Dev-Cpp and use the built-in package manager to download Allegro. It will set everything up for you and you will even have an Allegro "Hello World!" test program template under New Projects.

To compile, I think it's F9 or ctrl-F9. One is compile, one is compile+run.

Oh wait, you're not using an IDE are you...

LennyLen
Member #5,313
December 2004
avatar

Quote:

Just get Dev-Cpp and use the built-in package manager to download Allegro.

Likewise, why use an outdated, buggy, IDE to do that when you could use Code::Blocks to download and install the Dev-Paks.

edit: Oops, missed this...

Quote:

One last question: When I create a code, how do I compile it.(I'm using the C language.)

Either download an IDE like Code::Blocks , which makes things easier, or follow the instructions that came with MinGW about how to compile from the command line.

The simplest command line instruction will be: gcc -o program-name.exe file1.c file2.c ... -lalleg

coolmangroupof4
Member #8,580
April 2007

Thanks for helping me out! I couldn't understand any of the instalation instructions, but now it works! Thanks again!

Marco Radaelli
Member #3,028
December 2002
avatar

Kibiz0r said:

Why's everyone complicating this...

Well... you asked it: I think one should understand how low level things work before using an higher level tool that simplifies the work. Otherwise one comes out with things like this:

coolmangroupof4 said:

I couldn't understand any of the instalation instructions, but now it works!

(nothing against you, coolmangroupof4, of course :)).

Personally, I would understand the steps and commands that take a source code file to a working binary file, because they're the steps an IDE hides you under a click on a couple of buttons. This way if something goes wrong you can investigate a bit before going panic.

That's why I suggested him to get the source version and compile it by himself, it's hard in the beginning, but going throught the steps (and facing the problems you encounter), makes you more familiar with the tools.

Bijo++
Member #8,582
April 2007

Getting this thing to work is really a pain in the arse. I've been at it for a couple hours now. I usually know my way around with stuff, but when you encounter all these dead links and unclear info in text files......

The mingw32.txt on how to set things up is REALLY unclear and the standard directory name of Dev-C++ (for the path) that was put in is wrong -- the '-' was excluded. Setting up MINGDIR for WinXP is VERY UNCLEAR, and made me look up this forum.
Setting up mingw32 was also a pain but Dev-C++ has it too so a minimal installation with just that is good. And that link in the second post to get the pre-compiled is good stuff. I hope I can finally get crackin' with coding instead of banging my head against the wall with tedious annoying installations.

Oh, btw... I'm new here :)

Marco Radaelli
Member #3,028
December 2002
avatar

Bijo++ said:

Oh, btw... I'm new here :)

Welcome :)

Bijo++ said:

I usually know my way around with stuff, but when you encounter all these dead links and unclear info in text files......

I'm not the maintainer of such files, but can you post those links? So they can be checked :)

LennyLen
Member #5,313
December 2004
avatar

The following links are broken:

http://www.allegro.cc/files/install-devcpp.html
http://www.allegro.cc/files/install-msvc.html

edit:

Quote:

Setting up MINGDIR for WinXP is VERY UNCLEAR, and made me look up this forum.

Um...

mingw32.txt said:

f you use Windows NT/2k/XP, you can open the Control Panel, click the 'System' applet, the 'Advanced' tab and finally the 'Environment' button, and then add MINGDIR.

That's pretty clear.

Bijo++
Member #8,582
April 2007

Yeah, had also been googling around for an hour or more. Damn. Those two links and others I encountered, but it's too much of a hassle to look up now :)

Quote:

you use Windows NT/2k/XP, you can open the Control Panel, click the 'System' applet, the 'Advanced' tab and finally the 'Environment' button, and then add MINGDIR.

Actually, I did that but it didn't work. That's exactly the part where I got stuck, and then the mingw32.txt didn't really help that much further.

I prefer to use dmc.exe, though, not gcc or mingw, etc., it's confusing as hell and doesn't work for me, even if I've followed the damn directions. What is the proper way to set up Allegro for Digital Mars? Haven't seen any documentation for it, so I've been just "guessing" and hoping it's possible at all. (gcc is too much pain (even to look at).)
Have taken the pre-compiled Allegro and put the 'bin' and 'include' into my 'dm' (compiler) directory, and put the three DLLs into C:\windows\system32. [s]But when I compile my first -- har har(!) ;D -- simple basic Allegro program, it can't open the 'allegro.h' ? I instructed the compiler to look at it, but no.[/s] It gives me only errors now, but it least it can find allegro.h now :P
And what's the story with that 'lib' directory from the pre-compiled Allegro? They are all .a files, and I can't find any information about them.

All this searching and searching: arrrgh!

LennyLen
Member #5,313
December 2004
avatar

Quote:

I prefer to use dmc.exe, though, not gcc or mingw, etc., it's confusing as hell and doesn't work for me, even if I've followed the damn directions.

You probably haven't followed the directions then. The easiest way to get MinGW installed is to use the automated installer that is on SourceForge. It automatically downloads the various packages and installs them for you.

Quote:

And what's the story with that 'lib' directory from the pre-compiled Allegro? They are all .a files, and I can't find any information about them.

A .a file is MinGW/GCC's library file format. They won't work with any other compiler, so don't bother using the binaries with your compiler.

Bijo++
Member #8,582
April 2007

Alright, I think I got it running now -- mingw and followed the instructions in the .txt file for precompiled Allegro. I made a simple basic program but the compiler gives me too many errors, so I'm wondering if I've forgotten something or whether tthe simple code was wrong.

To sum up for clarity's sake what I got so far (excluding previous installation pains):

(1) I did the MinGW install; downloaded and installed through internet connection to C:\mingw; have only ticked C++ compiler, etc. stuff that looked necessary, for download.
(2) Followed the pre-compiled Allegro instructions (.txt file) for installation for mingw (-- moving lib, include, bin, to their necessary spots).
(3) Used "g++ <source> -o <output_name> -l alleg" to compile a simple test program here below:

#include <allegro.h>

int main
{
  allegro_init();
  install_keyboard();
  set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
  
  readkey();
  return 0;
}
END_OF_MAIN();

...and got some errors. Mainly about an invalid function and WinMain.

Did I forget something? Faulty code, or maybe it's something else? (tired :P)
Before that summary I downloaded and installed the latest DX SDK from April, but haven't done anything else with it yet. Must I do something with it? I vaguely recall something about DX header files, but I don't recall where I read it.

Marco Radaelli
Member #3,028
December 2002
avatar

You have no parenthesis after main...

Bijo++
Member #8,582
April 2007

Arrrgh! Such a little........ I think I need some sleep ;)

Thanks for the help, guys! Now that it's finally up and running, I'll start doing some Allegro and hope to get out some nice stuff :)

Go to: