How to load PNGs with Allegro in Ubuntu

The SourceForge project page explains generic instructions to install the AllegroPNG libraries in Linux. In Ubuntu it is very easy.

First, install Allegro if you don’t have it. By the time I wrote this entry, Allegro’s latest version was 4.2, so I installed it this way:

sudo apt-get install liballegro4.2-dev liballegro4.2

Then, download the latest version of AllegroPNG from its download section, extract the files and execute these two commands:

chmod +x configure
./configure
make

Now you’ll have to move two of the newly created files to your system’s library directories:

  • Move the file libalpng.a to the directory /usr/lib
  • Move the file src/alpng.h to the directory /usr/include

And that’s it. Now, every time you compile your allegro file, you should do it with the next command:

g++ main.cpp -o main `allegro-config --libs` -lalpng

Where the argument between the single quotation marks indicates that the file must be compiled using the allegro libraries, and the -lalpng argument indicates that it must use the alpng libraries.

One thought on “How to load PNGs with Allegro in Ubuntu

  1. pootie says:

    really thanks🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: