小编Suy*_*ooo的帖子

Ubuntu中的Allegro:对"al_install_system"的未定义引用

我今天尝试安装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 ===|
Run Code Online (Sandbox Code Playgroud)

我正在使用的代码:

#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 …
Run Code Online (Sandbox Code Playgroud)

c++ g++ allegro5 ubuntu-10.04

2
推荐指数
1
解决办法
8399
查看次数

标签 统计

allegro5 ×1

c++ ×1

g++ ×1

ubuntu-10.04 ×1