开发者

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

I have set up Allegro 5.0.4 with MinGW 4.5.2 and I am using the GUN GCC compiler with Code::Blocks.

When I attempt to compile this:

#in开发者_开发问答clude <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;
}

I receive the following build error.

Build Messages:

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 ===


See this:

  • http://www.allegro.cc/forums/thread/608101/928306#target

When you static link, if you get an undefined reference, just Google the function name (PathFindOnPath) and look up the library it needs. In this case it is "Shlwapi.lib".

Or, I suppose it's libshlwapi.a on MinGW.

That is: add that library to your list of linked libraries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜