Allegro in Dev-C++
Skax459

I'm trying Dev C++ (5.0) for the first time. I copied the Allgro Lib and Include stuff into the right folders, and tried to make this program:

//=================================
//Allegro Testing 101
//Samuel Milito, 14 Feb. 2007
//=================================
#include "allegro.h"

int main(void){
    allegro_init();
    set_gfx_mode(GFX_SAFE, 640, 480, 0, 0);
    install_keyboard();
  textprintf_ex(screen, font, 1, 469, makecol(0,0,0), makecol(255,255,255), "Version 4.5, 3 February 2007");
    while(!key[KEY_Q]){};
    allegro_exit();
    return EXIT_SUCCESS;
}END_OF_MAIN()

Under Project Options->Parameters->Linker I added -lalleg
Whenever I run it, it says:
[Linker error] undefined reference to '_imp__HERE'
Replace HERE with font, screen, key, and allegro_error
What is wrong?

Dustin Dettmer

Use the devpack manager instead to install allegro.

Skax459

Install from what? I have the lib, bin, and include folders...what do I do with them? Should I re-download Allegro?

Ok, I installed the package unit. Now it says:
[Build Error] [Labyrinth.exe] Error 1
Labyrinth is the name of the program. Anyone else encountered this?
(The error, not the game)

I'm going to try un- and reinstalling Dev-C++

Thomas Fjellstrom
Quote:

[Build Error] [Labyrinth.exe] Error 1

Um, thats only the last error, and means nothing to anyone. Always paste the FIRST errors, or all of them.

Quote:

I'm going to try un- and reinstalling Dev-C++

Don't be so hasty, just paste the errors, and we'll figure it out. Its mot likely that you have an error in YOUR code, causing gcc, and make to fail.

Lucid Nightmare

write a small code irst and then run it.
maybe running the framework of ur games for an example. If there's a problem with your existing code, then atleast this simple code would work. If not check out all the error areas shown and paste em ova here...

LennyLen
Quote:

Don't be so hasty, just paste the errors, and we'll figure it out.

Nah, just switch to Code::Blocks. ;)

But seriously though, the only reason to ever use Dev-C++ was the DevPaks, and Code::Blocks works with those. It also has many more features than Dev-C++ (and it's prettier).

Skax459

Well, for starters, I think there are 50 some errors that I don't really feel like typing. So I'll try uploading a picture. There is clearly something incredibly wrong with draw.inl.

I'm making a Windows GUI program, with -lalleg in the linker box.

All the errors are in the picture thats attached

Here is the code:

//================================
//Allegro Test Program
//================================
#include <allegro.h>

int main(void){
    allegro_init();
    set_gfx_mode(GFX_SAFE, 640, 480, 0, 0);
    install_keyboard();
    textout_ex(screen, font, "This doesn't work!", 10, 10, 10, 0);
    while(!key[KEY_Q]);
    allegro_exit();
    return 0;
}END_OF_MAIN()

LennyLen
Quote:

So I'll try uploading a picture.

A 2Mb BMP!?!? Have you never heard of GIF?

gnolam
LennyLen said:

Have you never heard of GIF?

Let me correct that for you:

LennyLen said:

Have you never heard of PNG?

Thomas Fjellstrom

Have you ever heard of copy and paste? or does Dev-CPP not let you save the errors? :o That'd be one (more) reason to NEVER EVER use it again.

edit, Oh thats great, it seems that allegro you have installed is configred for DJGPP? My my...

LennyLen
Quote:

Let me correct that for you:

I'm too lazy to fiddle with the PNG settings to get it to compress as much with GIF for images with few colours. Using default settings, that image came out 50% larger as a PNG than as a GIF.

Matthew Leverton
Quote:

I'm too lazy to fiddle with the PNG settings

Just save it as an 8-bit PNG if you want apples-to-apples comparison.

Quote:

Well, for starters, I think there are 50 some errors that I don't really feel like typing. So I'll try uploading a picture. There is clearly something incredibly wrong with draw.inl.

You are trying to use the DJGPP version. Uninstall Allegro and try again.

LennyLen
Quote:

Just save it as an 8-bit PNG if you want apples-to-apples comparison.

I use Paint Shop Pro and GIMP. In the former, you need to go through the properties section to change it to 8bit, or change any of the other settings. GIMP doesn't even give you this option (though it does have other settings you can alter). MS Paint is even worse, there's no way to change any settings.

When both formats were used with 8bit colour, PNG was smaller by 5%. Not worth the extra effort, IMO.

edit:

Skax459: If you're going to use Dev-C++, you might should follow Dustin's advice and use the only useful feature Dev-C++ has, the ability to download and install libraries for you. This way, it will install the correct version of Allegro for you.

To do this, go to the Tools menu and select Check for Updates/Packages. Select devpaks.org as the server, and it will generate a list of latest packages. Just find Allegro and it will automatically be downloaded and installed for you.

Matthew Leverton

You can save 8-bit PNG files in GIMP. GIF is like the IE of image formats to me, but mostly because of the stupid patents that Unisys was trying to enforce.

LennyLen
Quote:

You can save 8-bit PNG files in GIMP. GIF is like the IE of image formats to me, but mostly because of the stupid patents that Unisys was trying to enforce.

What version? I'm using 2.2, which I know isn't the latest version, and it has no option for 8bit PNG.

Matthew Leverton

Just switch to an indexed palette and save as PNG. I'm pretty sure it's supported that for a long time.

LennyLen
Quote:

Just switch to an indexed palette and save as PNG. I'm pretty sure it's supported that for a long time.

And where does one do that (when I create a new image, I get a choice of either RGB or greyscale, with no options for colour depth)? My help file is corrupted, and I don't actually use GIMP much (as you can probably tell). Actually, the only thing I really ever use it for is for nice font effects.

edit: Never mind. I downloaded a new version of the help file, and found out how to do it.

Michael Kowalski

Hi! I downloaded a package of Allegro from that page:
http://devpaks.org/details.php?devpak=32
And i got the same error:
[Linker error] undefined reference to `allegro_message'
And something about 50 errors 'undefined reference to....'
PLEASE someone help me, I don't know what is wrong with that ???

William Labbett

Likihood is you didn't link with liballeg.a .
The linker's wondering where the allegro functions come from.

CursedTyrant

Just pass -lalleg to the linker.

Michael Kowalski

Thnx it's workin' now :D

X-G

Quote:

I use Paint Shop Pro and GIMP. In the former, you need to go through the properties section to change it to 8bit

No you don't. Colors -> Decrease color depth.

zenofeller_
Quote:

the stupid patents that Unisys was trying to enforce.

wasn't that thrown out of various courts all through the 90's and then they just gave up ?

chaseC

responding to the original questions i just want to make it clear that when you download allegro from the package manager you add liballeg.a to the linker, not -lalleg.

CursedTyrant

It should work either way. At least it did for me.

AFAIK, liballeg.a == -lalleg

chaseC

when i do it only liballeg.a works, i always have to change it if i start a new allegro project although i usually just make a windows aplication

Thread #590074. Printed from Allegro.cc