
Tentei instalar a biblioteca allegro em meu sistema. Não recebi nenhum erro ao instalar a biblioteca, mas parece que algo deu errado durante a instalação. Meu código junto com os erros que estou recebendo ao compilar o programa:
/* testprog.c */
#include <allegro.h>
void init();
void deinit();
int main() {
init();
while (!key[KEY_ESC]) {
/* put your code here */
}
deinit();
return 0;
}
END_OF_MAIN()
void init() {
int depth, res;
allegro_init();
depth = desktop_color_depth();
if (depth == 0) depth = 32;
set_color_depth(depth);
res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
if (res != 0) {
allegro_message(allegro_error);
exit(-1);
}
install_timer();
install_keyboard();
install_mouse();
/* add other initializations here */
}
void deinit() {
clear_keybuf();
/* 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
$
Segui as instruções fornecidas nestes links para instalar a biblioteca e compilar meu programa:
Responder1
allegro_message()
gera uma mensagem, usando uma printf()
string de formato.
O erro está na linha:
mensagem_alegro(allegro_error);
Altere para:
allegro_message("%s\n", allegro_error);