Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro programs not compiling in ubuntu.. need help setting up!

This thread is locked; no one can reply to it. rss feed Print
Allegro programs not compiling in ubuntu.. need help setting up!
cameron
Member #8,219
January 2007

Hey,

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

#define ALLEGRO_STATICLINK
#include <allegro.h>

int main(){

  allegro_init();
  install_keyboard();
  set_gfx_mode(GFX_AUTODETECT , 640, 480, 0, 0);
  readkey();
  return 0;

}
END_OF_MAIN();

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
cameron@Ubuntu:~/projects$

what's wrong here, do you think?

thanks.

HoHo
Member #4,534
April 2004
avatar

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

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

cameron
Member #8,219
January 2007

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.

HoHo
Member #4,534
April 2004
avatar

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

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

Go to: