Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro 5 static linking problem

This thread is locked; no one can reply to it. rss feed Print
Allegro 5 static linking problem
hollow
Member #14,570
September 2012

Hello! Recently I had this problem while compiling an application. I was trying to static-link the allegro 5.0 DLL file, but I get some errors after it compiled all the files.

..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(wsystem.o):wsystem.c:(.text+0x67d): undefined reference to `GetModuleFileNameExA@16'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(wsystem.o):wsystem.c:(.text+0x6bd): undefined reference to `GetModuleFileNameExA@16'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x15): undefined reference to `GdiplusShutdown@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x55): undefined reference to `GdipGetImageEncodersSize@8'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0xa6): undefined reference to `GdipGetImageEncoders@12'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x1da): undefined reference to `GdipAlloc@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x212): undefined reference to `GdipCreateBitmapFromStream@8'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x24f): undefined reference to `GdipGetImageWidth@8'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x29b): undefined reference to `GdipGetImageHeight@8'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x367): undefined reference to `GdipBitmapLockBits@20'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x56b): undefined reference to `GdipBitmapUnlockBits@8'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x608): undefined reference to `GdipDisposeImage@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x620): undefined reference to `GdipFree@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x781): undefined reference to `GdipAlloc@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x7d6): undefined reference to `GdipCreateBitmapFromScan0@24'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x86d): undefined reference to `GdipBitmapLockBits@20'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0x8b1): undefined reference to `GdipSaveImageToStream@16'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0xa71): undefined reference to `GdipBitmapUnlockBits@8'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0xaf9): undefined reference to `GdipDisposeImage@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0xb0e): undefined reference to `GdipFree@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text+0xc74): undefined reference to `GdiplusStartup@12'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus14FontCollectionD0Ev[Gdiplus::FontCollection::~FontCollection()]+0x11): undefined reference to `GdipFree@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus23InstalledFontCollectionD0Ev[Gdiplus::InstalledFontCollection::~InstalledFontCollection()]+0x11): undefined reference to `GdipFree@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus13CustomLineCapD1Ev[Gdiplus::CustomLineCap::~CustomLineCap()]+0x14): undefined reference to `GdipDeleteCustomLineCap@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus5ImageD1Ev[Gdiplus::Image::~Image()]+0x14): undefined reference to `GdipDisposeImage@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus6BitmapD1Ev[Gdiplus::Bitmap::~Bitmap()]+0x14): undefined reference to `GdipDisposeImage@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN20AllegroWindowsStream14QueryInterfaceERK5_GUIDPPv+0xf): undefined reference to `IID_IUnknown'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN20AllegroWindowsStream14QueryInterfaceERK5_GUIDPPv+0x39): undefined reference to `IID_ISequentialStream'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN20AllegroWindowsStream14QueryInterfaceERK5_GUIDPPv+0x49): undefined reference to `IID_IStream'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus5Image5CloneEv[Gdiplus::Image::Clone()]+0x1f): undefined reference to `GdipCloneImage@8'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus5Image5CloneEv[Gdiplus::Image::Clone()]+0x35): undefined reference to `GdipAlloc@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus21PrivateFontCollectionD1Ev[Gdiplus::PrivateFontCollection::~PrivateFontCollection()]+0x4f): undefined reference to `GdipDeletePrivateFontCollection@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus12CachedBitmapD1Ev[Gdiplus::CachedBitmap::~CachedBitmap()]+0x14): undefined reference to `GdipDeleteCachedBitmap@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus13CustomLineCapD0Ev[Gdiplus::CustomLineCap::~CustomLineCap()]+0x15): undefined reference to `GdipDeleteCustomLineCap@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus13CustomLineCapD0Ev[Gdiplus::CustomLineCap::~CustomLineCap()]+0x1e): undefined reference to `GdipFree@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus12CachedBitmapD0Ev[Gdiplus::CachedBitmap::~CachedBitmap()]+0x15): undefined reference to `GdipDeleteCachedBitmap@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus12CachedBitmapD0Ev[Gdiplus::CachedBitmap::~CachedBitmap()]+0x1e): undefined reference to `GdipFree@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus5ImageD0Ev[Gdiplus::Image::~Image()]+0x15): undefined reference to `GdipDisposeImage@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus5ImageD0Ev[Gdiplus::Image::~Image()]+0x1e): undefined reference to `GdipFree@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus6BitmapD0Ev[Gdiplus::Bitmap::~Bitmap()]+0x15): undefined reference to `GdipDisposeImage@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus6BitmapD0Ev[Gdiplus::Bitmap::~Bitmap()]+0x1e): undefined reference to `GdipFree@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus21PrivateFontCollectionD0Ev[Gdiplus::PrivateFontCollection::~PrivateFontCollection()]+0x4f): undefined reference to `GdipDeletePrivateFontCollection@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(gdiplus.o):gdiplus.cpp:(.text$_ZN7Gdiplus21PrivateFontCollectionD0Ev[Gdiplus::PrivateFontCollection::~PrivateFontCollection()]+0x6a): undefined reference to `GdipFree@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(prim_opengl.o):prim_opengl.c:(.text+0x2d): undefined reference to `glDisableClientState@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(prim_opengl.o):prim_opengl.c:(.text+0x58): undefined reference to `glDisableClientState@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(prim_opengl.o):prim_opengl.c:(.text+0x72): undefined reference to `glEnableClientState@4'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(prim_opengl.o):prim_opengl.c:(.text+0x95): undefined reference to `glColorPointer@16'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(prim_opengl.o):prim_opengl.c:(.text+0x168): undefined reference to `glGetIntegerv@8'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(prim_opengl.o):prim_opengl.c:(.text+0x185): undefined reference to `glBindTexture@8'
..\allegro\lib\liballegro-5.0.6-monolith-static-md.a(prim_opengl.o):prim_opengl.c:(.text+0x194): undefined reference to `glMatrixMode@4'

Does anyone know how to solve these? I have included the lib files, yet it gives these errors. (Which didn't show in the past)

Neil Roy
Member #2,229
April 2002
avatar

I use CodeBlocks + MinGW-TDM (4.6.1) and downloaded and use the 5.0.7 binaries.

I link the following libraries for static linking...

\MinGW32\lib\Allegro5\liballegro-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\liballegro_acodec-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\liballegro_audio-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\libopenal-1.14-static-mt.a
\MinGW32\lib\Allegro5\libvorbisfile-1.3.2-static-mt.a
\MinGW32\lib\Allegro5\libvorbis-1.3.2-static-mt.a
\MinGW32\lib\Allegro5\liballegro_color-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\liballegro_dialog-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\liballegro_font-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\liballegro_image-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\liballegro_memfile-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\liballegro_physfs-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\liballegro_primitives-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\liballegro_ttf-5.0.7-static-mt.a
\MinGW32\lib\Allegro5\libdumb-0.9.3-static-mt.a
\MinGW32\lib\Allegro5\libFLAC-1.2.1-static-mt.a
\MinGW32\lib\Allegro5\libfreetype-2.4.8-static-mt.a
\MinGW32\lib\Allegro5\libogg-1.2.1-static-mt.a
\MinGW32\lib\Allegro5\libzlib-1.2.5-static-mt.a
gdiplus
uuid
kernel32
winmm
psapi
opengl32
glu32
user32
comdlg32
gdi32
shell32
ole32
advapi32
ws2_32
shlwapi

I keep my MinGW32 in C:\MinGW32. And of course in my code I have

#define ALLEGRO_STATICLINK

at the top of my code.

All works perfectly for me.

Oh, and I use the debug versions of Allegro for the debug build naturally.

---
“I love you too.” - last words of Wanda Roy

hollow
Member #14,570
September 2012

Thanks, I seem to have all those libs linked. I also defines STATIC_LINK. I still have the same problem, any ideas? Oh, and my MinGW is to up-to-date (4.6.1) So I'm not sure what's the problem o.o

Neil Roy
Member #2,229
April 2002
avatar

Do you have the libraries installed okay? Those errors you're getting seems to indicate that the gdiplus library and opengl libraries aren't getting linked in.

I would check to make sure you have them. Also make sure the path they're in is okay.

Look at the libs you're linking again, check and make sure you have "gdiplus", "opengl32" and "shlwapi" which has been a problem for me missing in the past.

---
“I love you too.” - last words of Wanda Roy

Elias
Member #358
May 2000

The order also is important.

--
"Either help out or stop whining" - Evert

hollow
Member #14,570
September 2012

I didn't know they had to be in the right order, although they probably are. I will double check it. And I have all the libs included on the right place and such. Then again it used to work in the past and I can't remember modifying anything important.
EDIT: It seems to be fixed :) I deleted all libs and re-added them in the right order and it didn't give errors this time. Thanks for all your support!

Neil Roy
Member #2,229
April 2002
avatar

Awesome, glad you got it worked out. :)

---
“I love you too.” - last words of Wanda Roy

hollow
Member #14,570
September 2012

I have another question though ^^ My application is loading a font file but I'm forced to have that in my directory just like dlls. Is there a possible way so I can compile my program so I don't need to include a font file in my directory to make it work? So it's basicly compiled in the exe already.

Inb4 thanks :)

SiegeLord
Member #7,827
October 2006
avatar

What is it with the perverse compulsion to stick everything into a single file ::).

The general solution for this kind of nonsense is this: http://www.allegro.cc/forums/thread/611083/966377#target

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: