Can anyone tell me why this isnt working? (Codeblocks/Allegro5.2)

Im having issues getting set up in a new environment. I am switching from MSVC to Code::Blocks and im having trouble compiling.

1mingw32-g++.exe -LC:\allegro\lib -LC:\allegro\allegro_deps\lib -LC:\MinGW\lib -o "bin\Release\Allegro5 Template.exe" obj\Release\Code\entry.o -s -lallegro-static -lallegro_main-static -lallegro_image-static -lallegro_dialog-static -lallegro_font-static -lallegro_memfile-static -lallegro_physfs-static -lallegro_primitives-static -lallegro_ttf-static -lvorbisfile -lvorbis -ldumb -lFLAC -lfreetype -logg -lzlib -lgdiplus -luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32 2obj\Release\Code\entry.o:entry.cpp:(.text.startup+0x1e): undefined reference to `al_install_system' 3obj\Release\Code\entry.o:entry.cpp:(.text.startup+0x23): undefined reference to `al_install_keyboard' 4obj\Release\Code\entry.o:entry.cpp:(.text.startup+0x2f): undefined reference to `al_set_new_display_flags' 5obj\Release\Code\entry.o:entry.cpp:(.text.startup+0x43): undefined reference to `al_create_display' 6collect2.exe: error: ld returned 1 exit status

Can anyone point me in the right direction? Ive got all of the compiler variables set up properly. I also have ALLEGRO_STATICLINK in the #define section of the options. It seems like its just not properly linking my libraries. I am also on Windows 8.1

Here is a generated file of the full output.

2-------------- Build: Release in Allegro5 Template (compiler: GNU GCC Compiler)--------------- 3mingw32-g++.exe -Wall -O2 -DALLEGRO_STATICLINK -IC:\allegro\include -IC:\allegro_deps\include -c "C:\Documents\CodeBlocks\Allegro5 Template\Code\entry.cpp" -o obj\Release\Code\entry.o 4mingw32-g++.exe -LC:\allegro\lib -LC:\allegro\allegro_deps\lib -LC:\MinGW\lib -o "bin\Release\Allegro5 Template.exe" obj\Release\Code\entry.o -s -lallegro-static -lallegro_main-static -lallegro_image-static -lallegro_acodec-static -lallegro_audio-static -lvorbisfile -lvorbis -lallegro_font-static -lallegro_ttf-static -lallegro_dialog-static -lallegro_memfile-static -lallegro_physfs-static -lallegro_primitives-static -ldumb -lFLAC -lfreetype -logg -lzlib -lgdiplus -luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32 -static-libgcc -static-libstdc++ 5obj\Release\Code\entry.o:entry.cpp:(.text.startup+0x1e): undefined reference to "al_install_system' 6obj\Release\Code\entry.o:entry.cpp:(.text.startup+0x23): undefined reference to "al_install_keyboard' 7obj\Release\Code\entry.o:entry.cpp:(.text.startup+0x2f): undefined reference to "al_set_new_display_flags' 8obj\Release\Code\entry.o:entry.cpp:(.text.startup+0x43): undefined reference to "al_create_display' 9collect2.exe: error: ld returned 1 exit status 10Process terminated with status 1 (0 minute(s), 1 second(s)) 115 error(s), 0 warning(s) (0 minute(s), 1 second(s))


Are you matching the architectures of the binaries with your compilers (32 vs 64 bits)? I seem to recall experiencing gcc silently ignoring incompatible binaries.


I had the architectures right but the version of the compiler was wrong.
Ive made slight progress only to find that the correct version is also wrong? Im kind of new to using mingw so im sorry if this seems stupid :p
Is there a difference in the mingw-w64 6.2.0 vs the mingw 6.2.0?

1-------------- Build: Release in Allegro5 Template (compiler: GNU GCC Compiler)--------------- 2 3g++.exe -Wall -O2 -DALLEGRO_STATICLINK -IC:\allegro\include -IC:\allegro_deps\include -I"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" -c "C:\Users\Eponick\Documents\GameMakerStudio2\CodeBlocks\Allegro5 Template\Code\entry.cpp" -o obj\Release\Code\entry.o 4g++.exe -LC:\allegro\lib -LC:\allegro\allegro_deps\lib -LC:\MinGW\lib -L"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64" -o "bin\Release\Allegro5 Template.exe" obj\Release\Code\entry.o -s -static-libgcc -static-libstdc++ -lallegro_monolith-static -lvorbisfile -lvorbis -ldumb -lFLAC -lfreetype -logg -lzlib -lgdiplus -luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32 -lshlwapi 5C:\allegro\lib/liballegro_monolith-static.a(d3d_display_formats.cpp.obj): In function `_al_d3d_generate_display_format_list': 6C:/dev/allegro_winpkg/universal/allegro/src/win/d3d_display_formats.cpp:49: undefined reference to `_Unwind_Resume' 7C:/dev/allegro_winpkg/universal/allegro/src/win/d3d_display_formats.cpp:50: undefined reference to `_Unwind_Resume' 8C:\allegro\lib/liballegro_monolith-static.a(d3d_display_formats.cpp.obj):d3d_display_formats.cpp:(.data+0x58): undefined reference to `__gxx_personality_seh0' 9C:\allegro\lib/liballegro_monolith-static.a(d3d_display_formats.cpp.obj):d3d_display_formats.cpp:(.xdata+0x2c): undefined reference to `__gxx_personality_seh0' 10collect2.exe: error: ld returned 1 exit status 11Process terminated with status 1 (0 minute(s), 2 second(s)) 125 error(s), 0 warning(s) (0 minute(s), 2 second(s))

Im in the process of compiling al5.2.2 myself with mingw 6.3.0.
Would people be interested in the binaries or not worth the upload?

Hopefully this fixes my problems.


There might be a difference with how exception handling is done (that's what those two symbols refer to).


The issue was the installation of mingw as I had suspected. Turns out to use the pre-built binaries you need MingW-W64 with x86_64 architecture, posix threads, and seh exception handling. Works fine now :)

Thanks for your help!

Johan Halmén

Could you tell which exact files you've used to get it working? I'm struggling with all of this. I'd like to have it running on my 64 bit machine. Is it so that if the newest Allegro binaries are in, I must use Mingw 6.2.0 and not Mingw 6.3.0 which is the newest one?

Thread #616743. Printed from