c – Ubuntu中的Allegro:对“al_install_system”的未定义引用
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c – Ubuntu中的Allegro:对“al_install_system”的未定义引用,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1644字,纯文字阅读大概需要3分钟。
内容图文
我今天尝试安装Allegro库.我在C中有相同的经验,但似乎我没有做过这样的事情.我从源代码编译了Allegro 5.0并将其放在/usr/lib/gcc/i486-linux-gnu/4.4/include/allegro5中.但是当我尝试编译我的代码时,会出现这种情况:
> g++ test2.cc -o test2
/home/chris/Desktop/c++/test2/.objs/main.o||In function `main':|
main.cpp:(.text+0x22)||undefined reference to `al_install_system'|
main.cpp:(.text+0x3e)||undefined reference to `al_create_display'|
main.cpp:(.text+0x6b)||undefined reference to `al_map_rgb'|
main.cpp:(.text+0x8e)||undefined reference to `al_clear_to_color'|
main.cpp:(.text+0x93)||undefined reference to `al_flip_display'|
main.cpp:(.text+0xa1)||undefined reference to `al_rest'|
main.cpp:(.text+0xa9)||undefined reference to `al_destroy_display'|
||=== Build finished: 7 errors, 0 warnings ===|
我正在使用的代码:
#include <stdio.h>
#include <allegro5/allegro.h>
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
if(!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}
display = al_create_display(640, 480);
if(!display) {
fprintf(stderr, "failed to create display!\n");
return -1;
}
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
al_rest(10.0);
al_destroy_display(display);
return 0;
}
allegro-config –libs什么都不返回.我首先将Allegro作为包装,但它也没有用.
解决方法:
您需要链接Allegro库,但您似乎没有这样做.
allegro-config --libs
returns nothing.
你问题的一部分.通常,您应该能够将它添加到命令行,如下所示:
g++ `allegro-config --libs` test2.cc -o test2
在我的系统(Ubuntu 10.10)上,它给出了:
$allegro-config --libs
-L/usr/lib -Wl,-Bsymbolic-functions -lalleg-4.2.2
你在调用正确的allegro-config吗?也许你应该指定它的完整路径?
内容总结
以上是互联网集市为您收集整理的c – Ubuntu中的Allegro:对“al_install_system”的未定义引用全部内容,希望文章能够帮你解决c – Ubuntu中的Allegro:对“al_install_system”的未定义引用所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。