Installing Allegro with Dev-C++
Fred Flagg

I have Dev-C++ 4.9.9.2 up and running. Now I want to compile/install Allegro to work with it. I have Allegro stored off in C:\Allegro.

The link I found in this forum giving directions to do that is broken. Any ideas where I can go next to find out how to get Allegro and Dev-C to work together?

Bob Keane

If you click on the tools icon, you should see a check for updates option. Selecting that will bring another screen, its been a while since I tried it, but the screen should be intuitive. You may have to change the website it searches. Once you make the connection, select the latest version of Allegro and download it. Then click on tools again, the last option should be the one you want (install devpaks?). You will see the Allegro devpak in the list. Select it and click the install button.

gnolam
Quote:

The link I found in this forum giving directions to do that is broken. Any ideas where I can go next to find out how to get Allegro and Dev-C to work together?

Allegro\docs\build\mingw32.txt

It contains all the info you need. I'd advise against devpaks.

Bob Keane

Come to think of it, the web update feature may install the package automatically. Good luck.

Bruce Fox

Select "devpaks.org" from the drop down list of the MENU>Tools>Check for Updates/Pacages.

Then click Check For Updates.

Lucid Nightmare
Bob Keane

After wasting an entire day, I found the solution. Quite simple, really.:-[

ImLeftFooted
gnolam said:

Allegro\docs\build\mingw32.txt

It contains all the info you need. I'd advise against devpaks.

I'd advise against compiling from source. The dev-cpp package updater contains everything you'd need to get allegro working.

Lucid Nightmare said:

I'd also like to reccomend you don't check out that link. Use the dev-cpp package updater.

HoHo

I'd advise to first install Allegro via the dev-cpp package updater.
Later when you find that you need a bit more speed you might want to consider building Allegro yourself and disabling ASM routines. That can give >50% speed increase in many functions.

gnolam

Do you even get the examples with devpaks?

miran
Quote:

Do you even get the examples with devpaks?

Yes.

...but it's a separate devpak. I think...

Dark Logan
Quote:

...but it's a separate devpak. I think...

Yes, it's the Allegro Supplement Package

Thomas Fjellstrom

Cause as we all know, Supplement == Examples ~~~`````1~~~~!!!!!!!

Vinny_CGR

I've used the package updater and it seem that the library isn't still working properly.
I was trying to make some simple things using Allegro and after typing this:
#include <allegro.h>
allegro_init();
And sending this to the compiler it returned this answer:
expected constructor, destructor, or type conversion before '(' token.
What is wrong?

Milan Mimica

int main() ?

Lucid Nightmare

Has someone even asked Fredd whether is he still stuck up with the installation problem or not... He just disappeared after starting the thread...

David_at_wedu

Hi all,

I too just started working with Dev-C++, and was in the process of making Allegro work with the IDE with little to no avail. While the library itself works -- my test "allegro_message()" call works, whenever I try to use any of the system variables like "extern int os_type," it keeps giving me the following compile error:

Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
gcc.exe -c GetInfomain.c -o GetInfomain.o -I"C:/Dev-Cpp/include"
gcc.exe GetInfomain.o -o "GetInfo.exe" -L"C:/Dev-Cpp/lib" -lalleg
Execution terminated
Compilation successful

Here is the code in my script:

#include <allegro.h>
int main()
{
allegro_init();
extern int os_type;
printf("OS Version = %s\n", os_type);
allegro_exit();
}
END_OF_MAIN();

At this point, I am at a loss for words. If it helps, I'm working on Windows XP Professional. I'm totally flustered and you guys are pretty much my last hope. :-[

Milan Mimica
Quote:

Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
gcc.exe -c GetInfomain.c -o GetInfomain.o -I"C:/Dev-Cpp/include"
gcc.exe GetInfomain.o -o "GetInfo.exe" -L"C:/Dev-Cpp/lib" -lalleg
Execution terminated
Compilation successful

???
Where is the error? It says "Compilation successful"!

edit:
BTW, you program does nothing. It initializes, prints a message and exits. It takes few nanoseconds to do that on modern computers.

Kitty Cat
Quote:

Compilation successful

What's the error?

And you don't need to declare os_type, since allegro.h already does. And you may want to turn on warnings (you're trying to use %s (a string) with an int; that will more than likely crash, and definitely not do what you expect).

David_at_wedu

D'oh... Stupid text didn't copy. Didn't realize... Here's the correct compile log text:

Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
gcc.exe -c GetInfomain.c -o GetInfomain.o -I"C:/Dev-Cpp/include"
gcc.exe GetInfomain.o -o "GetInfo.exe" -L"C:/Dev-Cpp/lib" -lalleg
Info: resolving _os_type by linking to __imp__os_type (auto-import)
fu000001.o(.idata$3+0xc): undefined reference to `lib_mingw32_liballeg_a_iname'
nmth000000.o(.idata$4+0x0): undefined reference to `_nm__os_type'
collect2: ld returned 1 exit status
make.exe: *** [GetInfo.exe] Error 1
Execution terminated

Quote:

And you don't need to declare os_type, since allegro.h already does. And you may want to turn on warnings (you're trying to use %s (a string) with an int; that will more than likely crash, and definitely not do what you expect).

The only reason I was declaring os_type was because it said to in the book I'm reading for using Allegro. However, if this is true, what would be the proper printf() call to output the value?

(As if you can't tell, I'm still a C newbie)

LennyLen
Quote:

However, if this is true, what would be the proper printf() call to output the value?

printf("OS Version = %d\n", os_type);

David_at_wedu
Quote:

printf("OS Version = %d\n", os_type);

Thanks!

I guess maybe I'll have to look a bit closer at what the book I'm reading says, because I was totally lost as to why I kept getting the compile errors (since the book told me to define extern int os_type).

Being a newbie sucks. ???

miran
Quote:

since the book told me to define extern int os_type

What's the title of the book?

HoHo
Quote:

What's the title of the book?

Wanna bet it's called "Game programming all in one"?
:P

miran

It was a rhetorical question.

David_at_wedu
Quote:

Wanna bet it's called "Game programming all in one"?

Might I ask what's so terrible about the book, or using a book like that to familiarize ones' self with game coding?

I prefer self-study to schooling -- that's where I got my start doing web development close to 9 years ago -- and I've become very successful. Learning to code games is something that I've wanted to do since I was a kid. Jonathan Harbour's book is the second book I've started reading. The first one I read through was Beginning C++ Game Programming by Michael Dawson.

gnolam
Quote:

Might I ask what's so terrible about the book, or using a book like that to familiarize ones' self with game coding?

It's that specific book that's horrible, not books in general. :)

In short: it contains a whole bunch of dodgy or just plain erroneous code, horrible programming practices, standards-breaking galore - and the author refuses to correct his mistakes.

David_at_wedu
Quote:

In short: it contains a whole bunch of dodgy or just plain erroneous code, horrible programming practices, standards-breaking galore - and the author refuses to correct his mistakes.

I wouldn't know erroneous code (from a C standpoint) or standards-breaking (same story) if I saw them; I have my own programming practices already.

What sort of stuff are you talking about? Any examples?

Thomas Fjellstrom
Quote:

Any examples?

Telling you to decare os_type when allegro.h already does?

David_at_wedu
Quote:

Telling you to decare os_type when allegro.h already does?

Actually, I reread that part of the book earlier today, and it's just worded funny and I read it wrong. It just names that command as something that's predefined. So it was my mistake. :-X

I'm still curious what other sorts of things raise red flags to you folks. I mean you seem like a pretty enthusiastic, close-knit community of coders. There's got to be some merit to the hate on that specific book. I'd just like some perspective by example.

Also, are there any books that you guys would recommend? I know there are tutorials on the site here, but I'm more the type that needs a tangible book to sit down and read; have trouble concentrating when reading off my notebook's LCD.

Matthew Leverton
Quote:

There's got to be some merit to the hate on that specific book.

In any beginner's book's defense... It will attract people who don't really know what they are doing. They will come to this site, ask a stupid question, and mention that they are using the book. Thus a bad association gets formed.

I've never seen this book, so I cannot comment on its entirety. But the author isn't very friendly to criticism and has engaged in fights on many occassions (both here and on his own site) with those who dare to not adorn him with praise. So couple that with the fact that the book does suffer from (at least) some bad practices (eg, conio.h) and a dislike is formed.

One example of his infamous advice is:

Quote:

Don't use the new version (4.2) of Allegro. It's a hokey mess. They've ruined Allegro and it has no future. Keep using the version described in the book, or go with one revision up, but not any further, because a bunch of "volunteers" have made a mess of it. That so-called "5.0" was scrapped entirely. So, don't trust new versions. Why anyway, when the last "good" revision in the book works fine?

David_at_wedu

I will say that I've encountered several instances where he uses depreciated functions, which I quickly just looked up here in the Allegro manual and found the updated function.

I've noticed that Mr. Harbour and I do have very different coding styles, and I've seen a few instances where he did things that the initial book I read -- and personal experience -- have taught me never to do. But I'm aware of those bad habits, so with any luck, I'll be able to inject a bit of my logic into my studies to keep from picking them up.

And yeah, I do totally agree that "All-in-One" or those "Teach Yourself insert language here in 24 hours" books are generally trash, but I actually have no complaints about his book so far. As long as I get what I need out of it, I'll be happy. I plan to continue my self-education beyond his book, but everything I read about it (comments on Amazon, etc.), it seemed like a good book to snag.

Keeping in mind that as I said before, I read Beginning C++ Game Programming (by Michael Dawson) first. That coupled with my existing programming experience, I feel like I have some good building blocks. Where I go from here? Well, they sky's the limit, but I hope this community is as helpful with everything else as they've been on this particular topic. :)

As an aside... You mentioned bad practices like conio. I did notice that while my initial read (Mr. Dawson's book) used iostream, Mr. Harbour's does use conio and stdlib. It seems to be very C-centric, where the other was strictly C++. I do kind of wish they both took the C++ approach, but I guess in all reality, the difference is just code structure.

Thomas Fjellstrom

conio isn't even C centric, its DOS centric.

Thread #585914. Printed from Allegro.cc