Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Installing allegro and/with dev-cpp

This thread is locked; no one can reply to it. rss feed Print
Installing allegro and/with dev-cpp
Don Juan
Member #6,784
January 2006

Hello everyone,

I am a complete and utter newbie when it comes to programming. This sounds kind of silly coming from the mouth of a third year software engineering student but fact of the matter is, I know absolutly nothing. In the midst of all the theoritical stuff on how to optimize my algorithm and how to make sure my software is of good quality they forgot to make us practice the theory (granted I could of practiced on my own...).

Anyways, I currently bought a book on how to program games using C and the Allegro library. Being excited and extremely motivated I made it to page 55 of 500 only to get stuck in the installation! I followed every step (I think... I tried like five times...) only to fail.

I figured I could try to download the latest version of both dev-cpp and allegro but the site that contains the tutorial on how to install them doesn't exist (error 404)... See, I don't really know how libraries and dev-cpp "hold hands" and I was never able to make them work!

So... if any of you guys know a good site (for a dummy) that explains how to install both these things together and explains why things are done without skipping any steps could you please refer me to them?

Thanks a lot in advance :)

Seb

[edit] PS: If there are no good webpages on the subject but someone is generous enough to help me install it, that is acceptable too :P
I've tried on and off again to install different libraries to program games only to get stuck at the library's installation... However this time I really do want to succeed but I also want to understand why I did something!

khristina yer
Member #5,795
May 2005
avatar

I might be wrong but I believe there is some documents in the src folders of allegro
under docs/doc.

Evert
Member #794
November 2000
avatar

Quote:

I currently bought a book on how to program games using C and the Allegro library.

Let me guess: Game Programming All in One, second edition?

Quote:

I figured I could try to download the latest version of both dev-cpp and allegro but the site that contains the tutorial on how to install them doesn't exist (error 404)... See, I don't really know how libraries and dev-cpp "hold hands" and I was never able to make them work!

I assume you have no problems with installing Dev-C++, as I figure it comes with a standard Windows installer. I wouldn't be able to help anyway.
To install Allegro, I believe you have several options. I think Dev-C++ has this thingy called `DevPacks' that you can use to install Allegro with, which should be easy enough to get to work.
Alternatively, I would suggest you grab a pre-compiled version from http://www.allegro.cc/files/. If you do want to install it, there should be a step-by-step guide in the documentantion that comes with Allegro (see the documentation for MinGW, since that's the compiler Dev-C++ uses).

Murat AYIK
Member #6,514
October 2005
avatar

Download this:http://prdownloads.sourceforge.net/alleg/allegro-4.2.0-1mol.DevPak
Double click to install it. Start a new project in DevC++, an Allegro template should be somewhere in "new project" window.

_____________________________________________________
"The world doesn't care about what storms you sailed through, it is interested in whether you brought the ship to the dock or not!"

Don Juan
Member #6,784
January 2006

Hey guys,

Thanks for the speedy reply. You are correct, it is in fact that book. Was it a bad choice on my part to purchase it?

Also, the book came with a cd which already had the devpaks. I did install them but when I coded the script to check whether allegro was configured right it didn't want to compile. Something about not finding some file (alle40.dll or something similar to it).

Someone mentioned in a thread that you had to write a path or something somewhere and the book also mentions this in the annexe but they never say which file to modify and what does what. That's where I got stuck.

[edit]

Well I DLed all the most recent versions and tried installing them following the intructions in the readme file of the precompiled version of allegro. After copy pasting the files in the right folders I got this compilation error.

1 
2#include <conio.h>
3#include <stdlib.h>
4#include "allegro.h"
5 
6int main()
7{
8 
9 allegro_init();
10 printf("Allegro version = %s\n", allegro_id);
11 printf("Press any key...\n");
12 getch();
13 return 0;
14 
15}
16END_OF_MAIN();

[Linker error] undefined reference to '__gxx_personality_v0'
Id returned 1 exit status
[Build Error] [GetInfo.exe] Error 1

okays... umm in the readme it says this:

The contents of the "bin" folder (three DLLs) should be placed
somewhere in your system's PATH. Normally they are put in the
C:\WINDOWS\SYSTEM32 folder.

Now how do I put it in the system's "PATH"? Do I have to edit a file? Which one?

relpatseht
Member #5,034
September 2004
avatar

You move the dlls from C:\Dev-C++\bin\alleg*.dll to C:\Windows\System32

However, that won't prevent this compiler error.

ReyBrujo
Moderator
January 2001
avatar

It seems it is an error from the Dev-C++ installation. You could try installing a newer version of Dev-C++.

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

Evert
Member #794
November 2000
avatar

Quote:

[Linker error] undefined reference to '__gxx_personality_v0'

That linker error means that you have compiled the code as C++ code but are trying to link it as C code. In that case, you won't be linking the C++ library, whence the error.
I don't know what settings you have to fiddle with to get that right, but try making sure that your filename's extension is .c, NOT .C.

Regarding the code you posted, here's a correct version (yes, I know you copy&pasted that from the book):

#include <stdlib.h>
#include "allegro.h"

int main()
{

    allegro_init();
    allegro_message("Allegro version = %s\n", allegro_id);
    return 0;

}
END_OF_MAIN()

gnolam
Member #2,030
March 2002
avatar

Evert: don't you mean

#include <stdlib.h>
#include <allegro.h>

int main()
{

    allegro_init();
    allegro_message("Allegro version = %s\n", allegro_id);
    return 0;

}
END_OF_MAIN()

? :)

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Don Juan
Member #6,784
January 2006

Awesome!

Well I'm not too sure what the conio.h file does... regardless the program compiled and ran! I had set up the project as a c++ (unintentionally) but was writing my code in C. So I made a new project and pasted my code in there. It compiled and I got my console app.

On a side note, I noticed that in your code you didn't include a semi colon at the end of END_OF_MAIN() was that intentional, if so, how does it work?

Thanks a lot guys, like A LOT.

Seb

gnolam
Member #2,030
March 2002
avatar

Quote:

On a side note, I noticed that in your code you didn't include a semi colon at the end of END_OF_MAIN() was that intentional, if so, how does it work?

It's intentional. END_OF_MAIN() is a macro expanding to a function, like this:

int foo()
{

}

So any semicolon will just be tacked on after the brace, which is superfluous.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Evert
Member #794
November 2000
avatar

Quote:

Evert: don't you mean

Yes. I also meant to include void as the argument to main, though that is even more of a stylistic question.

Quote:

Well I'm not too sure what the conio.h file does...

Nothing useful. It declares the getch() function which is not a standard C function that you have no reason to use anyway.

Go to: