我设置了 allegro5,简单的程序(比如显示一个窗口,用黑色背景填充)工作正常。但是,当我尝试导入其他 header (如 native 对话框)时,我遇到了问题。比如编译这段代码的时候
#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;
}
像这样
g++ -L/usr/local/lib -L/usr/lib -o "Allegro"./main.o -lallegro_main -lallegro
我收到这个错误
Undefined symbols for architecture x86_64:
"_al_show_native_message_box", referenced from:
_al_mangled_main() in main.o
知道谁来解决这个问题吗?我确信所有头文件都存在,并且/usr/local/libs 中似乎有合适的库。
编辑:我还尝试向 g++ 添加一个 -lallegro_native_dialog 标志,但没有成功。取而代之的是收到一条错误消息,提示 library not found for -lallegro_native_dialog
,在其他地方看到了建议,我想我会试一试。
最佳答案
是 -lallegro_dialog
而不是 -lallegro_native_dialog
!
关于c++ - 无法识别 Allegro 原生对话,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14249456/