Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro in Dev-C++

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Allegro in Dev-C++
Skax459
Member #8,290
February 2007

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?

ImLeftFooted
Member #3,935
October 2003
avatar

Use the devpack manager instead to install allegro.

Skax459
Member #8,290
February 2007

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
Member #476
June 2000
avatar

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.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Lucid Nightmare
Member #5,982
July 2005
avatar

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...

Click Here For My Website

Two Golden Rules of life- Firstly, I'm always right and secondly, if you think otherwise, slap your face and read rule number one again!

LennyLen
Member #5,313
December 2004
avatar

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
Member #8,290
February 2007

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
Member #5,313
December 2004
avatar

Quote:

So I'll try uploading a picture.

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

gnolam
Member #2,030
March 2002
avatar

LennyLen said:

Have you never heard of GIF?

Let me correct that for you:

LennyLen said:

Have you never heard of PNG?

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

Thomas Fjellstrom
Member #476
June 2000
avatar

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...

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

LennyLen
Member #5,313
December 2004
avatar

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
Supreme Loser
January 1999
avatar

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
Member #5,313
December 2004
avatar

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
Supreme Loser
January 1999
avatar

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
Member #5,313
December 2004
avatar

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
Supreme Loser
January 1999
avatar

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

LennyLen
Member #5,313
December 2004
avatar

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
Member #8,338
February 2007

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
Member #4,486
March 2004
avatar

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

CursedTyrant
Member #7,080
April 2006
avatar

Just pass -lalleg to the linker.

---------
Signature.
----
[My Website] | [My YouTube Channel]

Michael Kowalski
Member #8,338
February 2007

Thnx it's workin' now :D

X-G
Member #856
December 2000
avatar

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.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

zenofeller_
Member #8,364
February 2007

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 ?

I, however, am strongly suggesting that you START CAPITALIZING, FUCK IT! (gnolam)

chaseC
Member #8,368
February 2007

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
Member #7,080
April 2006
avatar

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

AFAIK, liballeg.a == -lalleg

---------
Signature.
----
[My Website] | [My YouTube Channel]

 1   2 


Go to: