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

Allegro compile error: undefined reference to "PathFindOnPathA@8"

本文关键字:PathFindOnPathA@8 引用 未定义 编译 错误 Allegro      更新时间:2023-10-16

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

当我尝试编译这个时:

#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:iliballegro-5.0.4-static-mt-debug.a(wsystem.o)
 In function "al_win_safe_load_library":
d:Librariesbuildallegrosrcallegro-5.0.xallegro-5.0.xsrcwinwsystem.c
 629 undefined reference to "PathFindOnPathA@8"
=== Build finished: 1 errors, 0 warnings ===

见:

    <
  • http://www.allegro.cc/forums/thread/608101/928306目标/gh>

当你的静态链接,如果你得到一个未定义的引用,只需谷歌函数名(PathFindOnPath),并查找它需要的库。在本例中是"Shlwapi.lib"

或者,我想它是libshlwapi。a on MinGW.

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