Undefined reference errors Allegro 5
Bob Keane

I've been trying to compile a project using Allegro 5 but getting "undefined reference to __cxa_guard_acquire" and "undefined reference to __cxa_guard_release" errors. I am using the allegro binaries from here: https://bitbucket.org/bugsquasher/unofficial-allegro-5-binaries/downloads/Allegro525_GCC81_MinGW_W64_i686_posix_dwarf.7z

and mingw gcc version 8.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project)

using codeblocks. Any ideas?

Mark Oates
Bob Keane said:

Any ideas?

Hate to give the obvious danky allegro.cc answer but, don't use codeblocks. 🤷‍♂️

I'm actually curious, though, what features specifically do you like about CodeBlocks?

Edgar Reynaldo

Codeblocks is great dude. Don't listen to him.

Which compiler did you download? Does it match the binaries? It looks like you have the right one.

Are you compiling as C++? Allegro is C++ on Windows.

Bob Keane

I've only tried one or two ides and settled with codeblocks. There is no specific reason I use it. The output from gcc -v is_

Using built-in specs.
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-8.1.0/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-pkgversion='i686-posix-dwarf-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/lib -L/c/mingw810/prerequisites/i686-zlib-static/lib -L/c/mingw810/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
Thread model: posix
gcc version 8.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project)

I'm coding in C, is Allegro only C++ on Windows? That would limit its usability in my opinion. If the problem is the compiler, do you have a link to the correct one? There are several on the download page.

Edgar Reynaldo

You can code in C all you want, but on Windows you have to compile any Allegro program as C++ due to the D3D driver being C++. It's really not a problem.

Bob Keane

After playing with it a bit, I coded it in C++. The error is gone. Should I hate MINGW or Microsoft for forcing me to learn a new language?


Don't need to learn a new language. Stick to C. Just compile in C++.

However, it never hurts to expand your knowledge.

Bob Keane

Unless it's my compiler, C++ seems stricter. I had a warning in some code when using the C compiler but it was an error for the C++ compiler.

DanielH said:

However, it never hurts to expand your knowledge.

You kids with your fancy new languages. What's wrong with BASIC?

Thread #618188. Printed from Allegro.cc