Allegro programs not compiling in ubuntu.. need help setting up!


I am using Ubuntu and used synaptic to install ALL allegro packages. then i made a program:

#include <allegro.h>

int main(){

  set_gfx_mode(GFX_AUTODETECT , 640, 480, 0, 0);
  return 0;


then i tried to compile it:

cameron@Ubuntu:~/projects$ g++ allegroworld.cpp -o allegroworld
/tmp/ccMEgS9v.o: In function `install_allegro':
allegroworld.cpp:(.text+0x10): undefined reference to `_get_allegro_version'
allegroworld.cpp:(.text+0x28): undefined reference to `get_config_text'
allegroworld.cpp:(.text+0x2d): undefined reference to `allegro_error'
allegroworld.cpp:(.text+0x41): undefined reference to `ustrzcpy'
allegroworld.cpp:(.text+0x63): undefined reference to `_install_allegro'
/tmp/ccMEgS9v.o: In function `main':
allegroworld.cpp:(.text+0x98): undefined reference to `install_keyboard'
allegroworld.cpp:(.text+0xc4): undefined reference to `set_gfx_mode'
allegroworld.cpp:(.text+0xc9): undefined reference to `readkey'
collect2: ld returned 1 exit status

what's wrong here, do you think?



You didn't link with allegro
g++ allegroworld.cpp -o allegroworld `allegro-config --libs`There might be something more, read the docs :)


thanks - works!

i take it u are developing on a linux too. if so, do u know of any IDEs that you can setup so you just hit F5 or something and it compiles and runs without the typing in the console? (as a newb, id like to spend more time learning and tweaking code and less time compiling stuff at the console) I'm using anjuta now.

thanks again.


If you know how to write makefiles then there are lots of "IDEs" (Kate, scite, *vi(m), ...) that can compile those makefiles when key is pressed. You can also try KDevelop (3.4 added and improved a lot of features compared to 3.3.x). I even created an Allegro project template for it. Though I'm not sure if it works any more. There are also Anjuta and Code::Blocks but I haven't tried those.

For simple projects with couple of files I usually use Kate and compile on commandline. With some more complex things I use KDevelop. Though I haven't actually used Allegro for about two years :P

Thread #589877. Printed from