Allegro编译错误:对“PathFindOnPathA @ 8”的未定义引用

时间:2011-08-15 22:59:18

标签: c++ compiler-errors allegro5

我已经使用MinGW 4.5.2设置了Allegro 5.0.4,我正在使用带有Code :: Blocks的GUN GCC编译器。

当我尝试编译时:

#include <stdio.h>
#define ALLEGRO_STATICLINK
#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;
}

我收到以下构建错误。

构建消息:

C:\i\liballegro-5.0.4-static-mt-debug.a(wsystem.o)
 In function "al_win_safe_load_library":

d:\Libraries\build\allegro\src\allegro-5.0.x\allegro-5.0.x\src\win\wsystem.c
 629 undefined reference to "PathFindOnPathA@8"

=== Build finished: 1 errors, 0 warnings ===

1 个答案:

答案 0 :(得分:3)

见:

  

当你静态链接时,如果你得到一个未定义的引用,只需谷歌功能名称(PathFindOnPath)并查找它需要的库。在这种情况下,它是“Shlwapi.lib”。

     

或者,我想这是MinGW上的libshlwapi.a。

即:将该库添加到链接库列表中。