Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am currently learning about game development tools and decided to use Allegro and OpenGL for starters. I've run into some problems in getting examples to compile though. It seems the allergro.h library isn't linking correctly. Some web searching didn't help.

Here's my example code:

#include <stdio.h>
#include <allegro.h>

int main()
{
    allegro_init();
    //...
    return 0;
}
END_OF_MAIN();

I'm running this command to compile it:

g++ allegroTemplate.cpp -o allegroTemplate

This is the error I'm getting:

/tmp/ccbpAXIY.o: In function `main':
allegroTemplate.cpp:(.text+0x2a): undefined reference to `_install_allegro_version_check'
collect2: ld returned 1 exit status

I'm running this in Ubuntu.

share|improve this question

closed as off-topic by Josh Petrie Nov 11 at 17:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem in your project must present a concise selection of code and context so as to allow a reader to diagnose the issue without needing to read all of your code or to engage in extensive back-and-forth dialog. For more information, see this meta thread." – Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

g++ allegroTemplate.cpp -o allegroTemplate

You aren't linking with Allegro. With Allegro 4, it's recommended to use the allegro-config command, like

g++ souce.cpp -o game $(allegro-config --libs)

If you are just getting started, you really should take a look at Allegro 5 instead. It has integrated OpenGL support and is actively being developed, unlike Allegro 4.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.