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:
#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;
}
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:
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.