Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » How to install allegro in ubuntu

This thread is locked; no one can reply to it. rss feed Print
How to install allegro in ubuntu
deepak_gtm63
Member #10,664
February 2009

I use allegro in Win Xp.Now, I want to use in Ubuntu Linux.But I couldn't find any idea about to install it in linux.Plese give me a specific and exact answer if you know....!!

Timorg
Member #2,028
March 2002

Your probably want to go...

sudo aptitude install liballegro4.2-dev

that only installs the stuff you need to develop programs, it doesn't have the debugging library. Or you could just install it from source.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

deepak_gtm63
Member #10,664
February 2009

I did what u have said but what to do to configure it.

Milan Mimica
Member #3,877
September 2003
avatar

What's there to configure?

deepak_gtm63
Member #10,664
February 2009

I mean to say that..After allegro installed by above mentioned,How to coonfigure linker settings or other setting,what are needed to run a allegro program.

amber
Member #6,783
January 2006
avatar

Assuming it's installed properly (and aptitude should take care of all that for you) you just need to #include <allegro.h> in your programs and link with -lalleg and it'll work fine.

Thomas Fjellstrom
Member #476
June 2000
avatar

amber said:

and link with -lalleg and it'll work fine.

Not quite. On linux you need to use `allegro-config --libs` instead of -lalleg

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

Timorg
Member #2,028
March 2002

Adding `allegro-config --cflags` or `allegro-config --cppflags` to the compiler flags wouldn't hurt either.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

deepak_gtm63
Member #10,664
February 2009

I mean to say that where to add "allegro-config --libs",Write in Detail..I couldn't understand it.

Timorg
Member #2,028
March 2002

Well that really does depend on the IDE (if any) that you are using, but in Code::Blocks...

{"name":"598110","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/c\/6c297a816a203d05c5bcdb8444ac5c5b.png","w":664,"h":504,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/c\/6c297a816a203d05c5bcdb8444ac5c5b"}598110
{"name":"598111","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/0\/60af806d00cbd5d33af28028d34f112e.png","w":664,"h":504,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/0\/60af806d00cbd5d33af28028d34f112e"}598111

If you are using a C project it should be `allegro-config --cflags` on the Compiler settings->Other options tab.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

Martin Kalbfuß
Member #9,131
October 2007
avatar

on the console do:

gcc game.c -o game `allegro-config --shared` or
gcc game.c -o game `allegro-config --static`

for a C++ project replace gcc with g++

that's all.

http://remote-lisp.spdns.de -- my server side lisp interpreter
http://www.nongnu.org/gm2/ -- Modula-2 alias Pascal++

Timorg
Member #2,028
March 2002

The `allegro-config --cppflags` is probably only needed when you have installed allegro to a non standard place. If you don't have root access to the machine or for whatever other reason.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

deepak_gtm63
Member #10,664
February 2009

I have done what you have said,and
I write a program like:-
#include<allegro.h>
int main()
{

allegro_init();
install_keyboard();
set_color_depth(16);
set_gfx_mode(GFX_AUTODETECT,640,480,0,0);

readkey();

return 0;

}
END_OF_MAIN();

and following error occured :-

-------------- Build: Debug in aaa ---------------

Compiling: main.cpp
g++: no input files
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

please help me.

Timorg
Member #2,028
March 2002

Did you create a new project? or just create a new source file and try to compile it? I will check that and see what happens... Well in my very old 8.02, not having a project compiled fine.

I will attach a project that is all setup to see if that works. (Attached is a simple hello world project. :))

Also, if you use the <code>put code here</code> tags, your code will be nicely formated and easy to read.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

deepak_gtm63
Member #10,664
February 2009

I think,my error is due to wrong choose of the applicaton type,i.e.,while clicking on creat a new project i have choosen console application,probably it is wrong.Which one is correct.

Timorg
Member #2,028
March 2002

I have always used "Console application" under linux, which is what the attached project was.

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

deepak_gtm63
Member #10,664
February 2009

Same souce code if i paste on the project u have given,it runs.But in case of project i have created choosing console application doesn't works.It gives the errors like
/home/deepak/Desktop/123/main.cpp|9|undefined reference to `_install_allegro_version_check' at the line where allegro_init() lies.what is the problem i cant understand.

Timorg
Member #2,028
March 2002

In a project go...

Project -> Build Options... -> <Project Name> -> Enable all compiler warnings (Overrides every other setting) [-Wall]

Where project name is top left, with release and/or Debug below it.

When you turn that option on go
Build->Rebuild workspace

The post the contents of build log here.

I hope that all made some sense (I am drunk, :D)

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

deepak_gtm63
Member #10,664
February 2009

that gives the same error like before.

Go to: