【发布时间】:2012-04-26 22:09:19
【问题描述】:
我遇到了与下面链接中询问的人相同的错误。已经有答案了,但我该怎么做呢?感谢您的帮助
https://stackoverflow.com/a/5294039/1333847
edit1) 这是代码:
#include "allegro5/allegro.h"
#include "allegro5/allegro_image.h"
#include "allegro5/allegro_native_dialog.h"
int main(){
ALLEGRO_DISPLAY *display = NULL;
ALLEGRO_BITMAP *image = NULL;
if(!al_init()) {
al_show_native_message_box(display, "Error", "Error", "Failed to initialize allegro!",
NULL, ALLEGRO_MESSAGEBOX_ERROR);
return 0;
}
if(!al_init_image_addon()) {
al_show_native_message_box(display, "Error", "Error", "Failed to initialize al_init_image_addon!",
NULL, ALLEGRO_MESSAGEBOX_ERROR);
return 0;
}
display = al_create_display(800,600);
if(!display) {
al_show_native_message_box(display, "Error", "Error", "Failed to initialize display!",
NULL, ALLEGRO_MESSAGEBOX_ERROR);
return 0;
}
image = al_load_bitmap("image.png");
if(!image) {
al_show_native_message_box(display, "Error", "Error", "Failed to load image!",
NULL, ALLEGRO_MESSAGEBOX_ERROR);
al_destroy_display(display);
return 0;
}
al_draw_bitmap(image,200,200,0);
al_flip_display();
al_rest(2);
al_destroy_display(display);
al_destroy_bitmap(image);
return 0;
}
这些是错误:
Undefined symbols for architecture x86_64:
"_al_show_native_message_box", referenced from:
__al_mangled_main in main.o
"_al_init_image_addon", referenced from:
__al_mangled_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
edit2) 记录此代码link to a code 一切正常
【问题讨论】:
-
您使用的是哪个版本的 Allegro?如果您使用的是比 5.0.0 更新的版本,这应该不是问题。
-
实际上我使用的是 5.1(不稳定)分支..甚至尝试了 svn 的 5(稳定)版本(应该是最新的)并且仍然相同
-
您应该在您的问题中包含您的错误消息详细信息,以防有什么不同。 (例如,忘记与 -lallegro_main 链接)
-
@Matthew:编辑了第一条消息以满足您的需求:)
标签: xcode4 xcode4.3 allegro allegro5