当我使用 g++ 编译我的 Allegro 5 程序时,它会抱怨undefined reference to 'al_init_primitives_addon', al_draw_filled_rectangle
allegro_primitives.h 中的其他此类函数。它不会抱怨 allegro.h 中的函数,例如al_create_display
.
包括:
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include "objects.h"
#include "main.h"
编译器命令:
g++ main.cpp -o game -lallegro -I/usr/include/allegro5 -L/usr/lib/allegro5
投诉:
/tmp/ccAyQlcl.o: In function `main':
main.cpp:(.text+0xef): undefined reference to `al_init_primitives_addon'
/tmp/ccAyQlcl.o: In function `Draw()':
main.cpp:(.text+0x38c): undefined reference to `al_draw_filled_rectangle'
main.cpp:(.text+0x415): undefined reference to `al_draw_filled_rectangle'
顺便说一句,MSVC++ 编译得很好。