Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Error when linking A5 static

This thread is locked; no one can reply to it. rss feed Print
Error when linking A5 static
Aleksa
Member #14,874
January 2013

I followed this tutorial and after that I get these errors:

||=== Build: Debug in browser_allegro (compiler: GNU GCC Compiler) ===|
C:\Users\Aleksa\Desktop\igre i programi\Unturned Projekat\browser_allegro\main.c||In function 'main':|
C:\Users\Aleksa\Desktop\igre i programi\Unturned Projekat\browser_allegro\main.c|20|warning: comparison between pointer and integer [enabled by default]|
C:\Users\Aleksa\Desktop\igre i programi\Unturned Projekat\browser_allegro\main.c|36|warning: comparison between pointer and integer [enabled by default]|
C:\Users\Aleksa\Desktop\igre i programi\Unturned Projekat\browser_allegro\main.c|43|warning: comparison between pointer and integer [enabled by default]|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp|| undefined reference to `_Unwind_Resume'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp|| undefined reference to `_Unwind_Resume'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp:(.eh_frame+0x63)||undefined reference to `__gxx_personality_v0'|
||=== Build failed: 3 error(s), 3 warning(s) (0 minute(s), 0 second(s)) ===|

Neil Roy
Member #2,229
April 2002
avatar

Without seeing any of your source code, I would have to say, that according to the above error messages, you're comparing a pointer and integer. :)

Start with the first error. What does line 20 of your main.c have? Also lines 36 and 43 are all doing the same thing, I assume with the same variables most likely.

Also make sure you're linking in the right libraries. I compile all my Allegro 5 projects as static without problems using MinGW (GNU compiler). And with my latest project, I am using the same as you, 5.0.10 static. Here's what I include in my libs... (from Code::Blocks that would be in "Projects->Build Options->Linker Settings)

gdiplus
uuid
kernel32
winmm
psapi
opengl32
glu32
user32
comdlg32
gdi32
shell32
ole32
advapi32
ws2_32
shlwapi

As well as the usual Allegro Libraries.

Edit: also note the order they are added can be important. This works for me.

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

jmasterx
Member #11,410
October 2009

Here are mine, but I use mscvc

#SelectExpand
1physfs.lib 2d3dx9.lib 3dsound.lib 4d3d9.lib 5opengl32.lib 6dxguid.lib 7dinput8.lib 8kernel32.lib 9user32.lib 10gdi32.lib 11comdlg32.lib 12ole32.lib 13Shlwapi.lib 14psapi.lib 15winmm.lib 16libFLAC-1.2.1-static-mt.lib 17freetype242MT.lib 18libogg_static.lib 19zlib-1.2.5-static-mt.lib 20gdiplus.lib 21libvorbis_static.lib 22dumb-0.9.3-static-mt.lib 23libvorbisfile_static.lib 24libcmt.lib 25allegro-static.lib 26allegro_shader-static.lib 27allegro_acodec-static.lib 28allegro_primitives-static.lib 29allegro_image-static.lib 30allegro_physfs-static.lib 31allegro_color-static.lib 32allegro_memfile-static.lib 33allegro_audio-static.lib 34allegro_dialog-static.lib 35allegro_ttf-static.lib 36allegro_font-static.lib 37agui.lib 38agui_allegro5.lib 39lacewing.lib 40ws2_32.lib 41mpr.lib 42mswsock.lib 43secur32.lib 44crypt32.lib 45openal-1.14-static-mt.lib

I also have networking and gui libraries in there and their dependencies.

Aleksa
Member #14,874
January 2013

lines 20, 36 and 43 are not the problem

#SelectExpand
1if (al_init() == NULL) 2if (al_install_keyboard() == NULL) 3if (al_install_mouse() == NULL)

problem is with "undefined reference to..." errors which are still here after re-adding all these:

gdiplus
uuid
kernel32
winmm
psapi
opengl32
glu32
user32
comdlg32
gdi32
shell32
ole32
advapi32
ws2_32
shlwapi

Also what means "keep this as relative path"?

{"name":"608853","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6a3ec16f1f76929b0f096ac7bb7499fa.png","w":905,"h":374,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6a3ec16f1f76929b0f096ac7bb7499fa"}608853

EDIT: After adding some physfs code i get this error messages (removed 23, 36 and 43 lines error):

||=== Build: Debug in browser_allegro (compiler: GNU GCC Compiler) ===|
C:\Users\Aleksa\Desktop\igre i programi\Unturned Projekat\browser_allegro\main.c||In function 'main':|
C:\Users\Aleksa\Desktop\igre i programi\Unturned Projekat\browser_allegro\main.c|56|warning: implicit declaration of function 'PHYSFS_init' [-Wimplicit-function-declaration]|
C:\Users\Aleksa\Desktop\igre i programi\Unturned Projekat\browser_allegro\main.c|57|warning: implicit declaration of function 'PHYSFS_mount' [-Wimplicit-function-declaration]|
C:\Users\Aleksa\Desktop\igre i programi\Unturned Projekat\browser_allegro\main.c|61|warning: implicit declaration of function 'al_set_physfs_file_interface' [-Wimplicit-function-declaration]|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp|| undefined reference to `_Unwind_Resume'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp|| undefined reference to `_Unwind_Resume'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp:(.eh_frame+0x63)||undefined reference to `__gxx_personality_v0'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro_physfs-5.0.10-static-mt.a(zip.o):zip.c|| undefined reference to `inflateEnd'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro_physfs-5.0.10-static-mt.a(zip.o):zip.c|| undefined reference to `inflate'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro_physfs-5.0.10-static-mt.a(zip.o):zip.c|| undefined reference to `inflateInit2_'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro_physfs-5.0.10-static-mt.a(zip.o):zip.c|| undefined reference to `inflateEnd'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro_physfs-5.0.10-static-mt.a(zip.o):zip.c|| undefined reference to `inflateInit2_'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro_physfs-5.0.10-static-mt.a(zip.o):zip.c|| undefined reference to `inflate'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro_physfs-5.0.10-static-mt.a(zip.o):zip.c|| undefined reference to `inflateEnd'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro_physfs-5.0.10-static-mt.a(zip.o):zip.c|| undefined reference to `inflateInit2_'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro_physfs-5.0.10-static-mt.a(zip.o):zip.c|| undefined reference to `inflateEnd'|
||=== Build failed: 12 error(s), 6 warning(s) (0 minute(s), 0 second(s)) ===|

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Aleksa said:

implicit declaration of function 'PHYSFS_init'

You didn't include the physfs header.

Quote:

undefined reference to `inflateEnd'

You didn't link to zlib.

Quote:

lines 20, 36 and 43 are not the problem

if (al_init() == NULL) 
if (al_install_keyboard() == NULL) 
if (al_install_mouse() == NULL)

NULL and 0 are not the same thing. One is a pointer, the other is an integer.

if (!al_init()) {/*...*/}

Aleksa
Member #14,874
January 2013

I cant find zlib on my computer :(
EDIT: found it :D
I still have these errors:

||=== Build: Debug in browser_allegro (compiler: GNU GCC Compiler) ===|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp|| undefined reference to `_Unwind_Resume'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp|| undefined reference to `_Unwind_Resume'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp:(.eh_frame+0x63)||undefined reference to `__gxx_personality_v0'|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Aleksa said:

undefined reference to `_Unwind_Resume'|

This is usually caused by linking different versions of libraries. You probably have the wrong binaries for your version of MinGW. No, they are not cross compatible. If there are no binaries for your version of MinGW you have to build allegro yourself.

But look here for the correct versions first :
http://targonski.nazwa.pl/thedmd/allegro/

Neil Roy
Member #2,229
April 2002
avatar

Just so you know, I use Code::Blocks with a separately installed MinGW v4.7.0 and the Allegro 5.0.10 binaries for 4.7.0 and it works beautifully. No compile problems at all.

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

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Neil Roy
Member #2,229
April 2002
avatar

Wrong person, I was telling him what I use that works for me. ;)

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

Aleksa
Member #14,874
January 2013

Its probably because I installed a4 over a5 and some files might changed to older versions. I will reinstall a5.
EDIT:
Ok it still doesn't work even after installing contrib file (i already had all that files but I reinstalled it).

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Neil Roy
Member #2,229
April 2002
avatar

Allegro 4 has different filenames, so I doubt very much that would effect it.

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

Aleksa
Member #14,874
January 2013

i will try that tomorow when i come home.

I get same:

||=== Build: Debug in browser_allegro (compiler: GNU GCC Compiler) ===|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp|| undefined reference to `_Unwind_Resume'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp|| undefined reference to `_Unwind_Resume'|
..\..\..\..\..\..\Program Files (x86)\CodeBlocks\MinGW\lib\liballegro-5.0.10-static-mt.a(d3d_display_formats.o):d3d_display_formats.cpp:(.eh_frame+0x63)||undefined reference to `__gxx_personality_v0'|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Go to: