Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » undefined reference to "al_filename_exists" and others on static linking

This thread is locked; no one can reply to it. rss feed Print
undefined reference to "al_filename_exists" and others on static linking
Fox Leader
Member #12,999
July 2011

Hello everybody, I'm developing a game engine which is supposed to embed all the libraries used into a single dll. Everything worked fine until I decided to upgrade from allegro 5.1.8 to 5.1.13, now if I try to build it I get an undefined reference for 4 allegro functions, specifically:

al_create_fs_entry
al_destroy_fs_entry
al_filename_exists
al_get_fs_entry_mode

I was wondering what library I'm missing, in my windows build I'm currently including:

-lallegro-static -lallegro_dialog-static -lallegro_font-static -lallegro_ttf-static -lallegro_physfs-static -lallegro_primitives-static -lallegro_color-static -lallegro_image-static -lshlwapi -lole32 -lgdi32 -lgdiplus -luuid -lopengl32 -lglu32 -lwinmm -lkernel32 -lpsapi -lComdlg32 -lxlsreader -lfreetype

any tips?

p.s.: I tried both the allegro official builds and a custom one I made, I'm working on mingw w64 5.3.0

Peter Hull
Member #1,136
March 2001

Does the order of linking matter?
i.e. if you put -lallegro-static after all the other Allegro libraries?
Just a guess.

Bruce Pascoe
Member #15,931
April 2015
avatar

Yes, allegro_static should be linked after all the addon libraries. With the exception of MSVC, libraries must be given to the linker in dependency order, e.g. if B depends on A, then B must come before A on the command line.

Fox Leader
Member #12,999
July 2011

Yeah I realized it myself this morning, thanks anyway for pointing that out :)

Peter Hull
Member #1,136
March 2001

Bonus question then - why did it work on 5.1.8?

Fox Leader
Member #12,999
July 2011

man... I have no clue. This morning I just thought those functions were not there before, but I just checked the docs from 5.1.8 and they were present already... and I've been upgrading allegro since at least 5.1.6 without changing the linking order as far as I remember, which makes it even more strange.
Maybe it has something to do with Eclipse?

Go to: