0
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$

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