1

I'm new to Allegro, Ubuntu, and C++ ... sorry in advance...

I just installed Allegro 4. Something from the ubuntu software manager. I then followed the directions of this page to install Allegro 5. I don't think my libs are linked correctly, but I don't exactly know how to manually change that.

My code:

#include <allegro.h> //the allegro 4 header?
#include <allegro/allegro5.h> //the allegro 5 header?

int main(){
    allegro_init();
}

END_OF_MAIN()

My compile line:

g++ allegro_test.cpp -o output.out `pkg-config --libs allegro5.0`

My output:

allegro_test.cpp (.text+0x2a) undefined refrence to '_install_allegro_check_version'

I assume it is similar to this question, but I cannot figure out how to get the library linked. I'd like to have it know automatically.

Community
  • 1
  • 1
Jeff
  • 4,285
  • 15
  • 63
  • 115

2 Answers2

2

I know it's too late to answer this, but there might be someone somewhere seeking for an answer.

the header file is wrong; it should be like this:-

#include <allegro5/allegro.h>
Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Ahmad
  • 31
  • 2
1

From the question you linked:

gcc foo.c -o foo $(pkg-config --libs allegro-5.0)

However, the source code you've posted is Allegro 4. Allegro 5 is not backward compatible. The A5 equivalent is:

#include <allegro/allegro5.h>

int main() {
   al_init();
   return 0;
}
Matthew
  • 47,584
  • 11
  • 86
  • 98
  • That seems to have been it... the rest of my commented out code to initialize the keyboard and such needs to be updated now too. Thanks!!!! – Jeff Jul 13 '11 at 20:35
  • The manual @ http://allegro.cc/manual/5/ should be helpful. It also has inline links to any examples that use the particular function on that page. – Matthew Jul 13 '11 at 21:00