views:

578

answers:

2

Ok first off, I am linking to boost_system and boost_filesystem.

My compiler is a custom build of MinGW with GCC 4.3.2

So when I include:

#include "boost/filesystem.hpp"

I get linking errors such as:

..\..\libraries\boost\libs\libboost_system.a(error_code.o):error_code.cpp:
    (.text+0xe35)||undefined reference to `_Unwind_Resume'|

..\..\libraries\boost\libs\libboost_system.a(error_code.o):error_code.cpp:
    (.eh_frame+0x12)||undefined reference to `__gxx_personality_v0'|

Which after a little searching I found is most commonly when you try to link a C++ program with gcc, the GNU C compiler. But I printed out the exact build command that Code::Blocks is running, and it is definitely linking with g++.

If I comment out this include, everything works fine.

Any ideas? Also, as a side, anyone know of a good place to get windows binaries for boost? The build system is giving me issues, so I'm using some binaries that came with this custom MinGW package

A: 

Windows binaries: www.boost.org - see the "Getting Started" page - but if you're using g++ on MingGW you don't want those. A simple way to understand it is, MingGW is like an operating system inside an operating system so really you're not actually using Windows. The ones you've got are probably right.

Not sure what's going on with your code though, sounds like the lib files aren't linking in properly somehow. Boost names its lib files by themselves so you don't actually name them explicitly, but you have to have the lib files for boost on the right path (and make sure they're installed/built too, which they might not be). I'm not sure how to get them on the right path with g++ because I haven't used MingGW, I've only used boost with Visual Studio.

Ray Hidayat
+1  A: 

Ok, I found the problem. It's a bit convoluted.

GCC is gradually becoming more IS 14882 compliant in the 4.x branch. As they go on, they are removing deprecated non-standards complaint features.

While 4.1.x seem to only have them deprecated and not removed, 4.3.x seems to actually have them removed. What this means is 4.3.x and greater have some backwards compatibility issues with things compiled in the 3.x branch (which used the deprecated and now removed features)

I was using a mix and match combination of binaries that had been compiled with GCC 3.x, 4.1.x and 4.3.x so no matter which one I used, I got a similar error, because at least one binary I was linking to was incompatible with the compiler I was trying at the moment.

I'm now using GCC 4.1.2 and most of my binaries have been compiled with it. I am still how ever using a few binaries from 3.x, which is why I am not upgrading to 4.3.x just yet.

Hope that was less confusing to read than it was to write...

This seems to be a good post addressing some of the issues as they were with 4.1.x

Adam
As far as I know, GCC 2.95, 2.96, 3.0, 3.1.1, 3.2, and 3.4 all broke C++ ABI compatibility with previous versions, so you can't mix binaries between them. In theory, 3.4 and up (including 4.x, I believe) should all be compatible, at least until they break compat again...
ephemient
great, i didn't know this, thanks for the info
Adam