问题
I got allegro5 set up, and simple programs (like displaying a window, filling it with a black background) work fine. When I try importing other headers (like native dialogs) though, I run into problems. For example, when compiling this code
#include <allegro5/allegro.h>
#include <allegro5/allegro_native_dialog.h>
int main(){
if(al_init()) {
al_show_native_message_box(al_get_current_display(),
"Window Title",
"Content Title",
"The error message here",
NULL, ALLEGRO_MESSAGEBOX_ERROR);
return 0;
}
return 0;
}
like so
g++ -L/usr/local/lib -L/usr/lib -o "Allegro" ./main.o -lallegro_main -lallegro
I get this error
Undefined symbols for architecture x86_64:
"_al_show_native_message_box", referenced from:
_al_mangled_main() in main.o
Any idea who to fix this? I am positive all the header files exist, and there seem to be the proper libraries in /usr/local/libs.
EDIT: I also tried adding a -lallegro_native_dialog flag to g++ with no avail. Instead get an error saying library not found for -lallegro_native_dialog
, saw the suggestion elsewhere and thought I'd give it a shot.
回答1:
It's -lallegro_dialog
not -lallegro_native_dialog
!
来源:https://stackoverflow.com/questions/14249456/allegro-native-dialogues-not-recognized