
On Sat, Mar 13, 2010 at 10:16 PM, Benjamin Lau
Hello everyone,
I successfully compiled Boost with MinGW (GCC 4.4.0 - it came installed with the Qt SDK) with all the settings on, so it has generated both dynamic and static libraries, debug and release versions, multithreaded and non-multithreaded runtimes etc. I tried to compile a small program that uses the serialization library (http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/tutorial.html#si...) and tried to link it statically with these libraries (in different compilations):
libboost_serialization-mgw34-1_40.lib libboost_serialization-mgw34-mt-1_40.lib libboost_serialization-mgw34-mt-s-1_40.lib libboost_serialization-mgw34-mt-s.lib libboost_serialization-mgw34-mt.lib libboost_serialization-mgw34-s-1_40.lib libboost_serialization-mgw34-s.lib libboost_serialization-mgw34.lib
Each time I compiled, it would always give me linker errors like so:
undefined reference to `__gxx_personality_sj0' undefined reference to `_Unwind_SjLj_Register' undefined reference to `_Unwind_SjLj_Unregister' undefined reference to `_Unwind_SjLj_Resume'
These are repeated over and over again. The compiler command and flags that I use are g++ test.cpp -o test -Ipath/to/boost/include path/to/static/library
However, if I compile it with an import library like boost_serialization-mgw34.lib I don't get such errors.
Searching online seems to suggest I am missing a compiler flag, but I cannot determine which one I am missing. Perhaps my Google-Fu isn't strong enough, so if I did miss out something patently obvious that could have been found online I offer my due apologies.
You need to enable exception handling. I have no clue what the GCC flag for that it, but that is what needs to be done (/Eh ?). Your runtime must also have exception handling support (assuming Qt did not chance anything in the normal runtime build for MingW's GCC, it should).