Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tried installing allegro library on my system.I didn't get any error while installing the library, but it seems that something went wrong while installation. My code along with the errors I'm getting while compiling the program:

    /* testprog.c */

#include <allegro.h>

void init();
void deinit();

int main() {

while (!key[KEY_ESC]) {
/* put your code here */

return 0;

void init() {
int depth, res;
depth = desktop_color_depth();
if (depth == 0) depth = 32;
res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
if (res != 0) {

/* add other initializations here */

void deinit() {
/* add other deinitializations here */

Errors I'm getting:

$ gcc testprog.c -o testprog `allegro-config --cflags --libs`
testprog.c: In function ‘init’:
testprog.c:26:1: warning: format not a string literal and no format arguments [-Wformat-security]
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

I've followed instructions given on these links for installing the library and compiling my program:

Instructions for installing allegro on ubuntu

Instructions for compiling programs written in allegro

share|improve this question
The question is missing the important text. There are no links. Please check the question again. – green Mar 21 '13 at 19:35
oh! sorry! my mistake! let me edit it – Upasana Mar 21 '13 at 19:36
what is END_OF_MAIN() ? – green Mar 21 '13 at 19:45
It is predefined macro,in order to maintain cross-platform compatibility, you have to put this macro at the very end of your main function, please check this: – Upasana Mar 21 '13 at 19:50
It's for allegro 4, right? – int_ua Nov 20 '14 at 17:19

allegro_message() outputs a message, using a printf() format string.

The error is in the line:


Change it to:

allegro_message("%s\n", allegro_error);
share|improve this answer
Still getting the same error :( – Upasana Mar 21 '13 at 20:00
Let's continue this discussion on chat – green Mar 21 '13 at 20:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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