2015-07-28 14:44 GMT+02:00 Edward Diener <eldlistmaili...@tropicsoft.com>:
> On 7/28/2015 8:27 AM, Edward Diener wrote: > > Without trying immediately to give specific code for what is a large > > project, I am getting linker errors when trying to link a second shared > > library which depends on a first shared library that has linked > > successfully. The errors are: > > > > > xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTVN5boost7archive21xml_archive_exceptionE[__ZTVN5boost7archive21xml_archive_exceptionE]+0x20): > > undefined reference to `virtual thunk to > > boost::archive::archive_exception::what() const' > > > xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE[__ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE]+0x38): > > undefined reference to `virtual thunk to > > boost::archive::archive_exception::what() const' > > collect2.exe: error: ld returned 1 exit status > > > > The xml_wgrammar.o file is being linked into the second shared library. > > The xml_wgrammar.cpp file includes xml_archive_exception.hpp. The > > xml_archive_exception.hpp includes and derives from > > archive_exception.hpp. Both xml_archive_exception and archive_exception > > have their implementation in the first shared library and have their > > necessary implementations exported. The implementation of > > archive_exception::what() is exported in the first shared library and is > > imported when seen by xml_wgrammar.cpp. > > > > What is so strange is that there is no call to archive_exception::what() > > in the preprocessed output of xml_wgrammar.cpp. > > > > Does anybody have any idea what might be going on here before I take the > > time to reduce this situation into a short enough fragment to show in a > > subsequent thread in this post ? > > After adding an xml_archive_exception::what() implementation which just > calls its base class archive_exception::what() implementation I now > receive the linker errors: > > xml_wgrammar.o: In function `ZN5boost7archive21xml_archive_exceptionD1Ev': > xml_archive_exception.hpp:34: undefined reference to `vtable for > boost::archive::xml_archive_exception' > xml_archive_exception.hpp:34: undefined reference to `vtable for > boost::archive::xml_archive_exception' > xml_archive_exception.hpp:34: undefined reference to `vtable for > boost::archive::xml_archive_exception' > xml_archive_exception.hpp:34: undefined reference to `VTT for > boost::archive::xml_archive_exception' > collect2.exe: error: ld returned 1 exit status > > Perhaps this will give someone an idea of what might be happening. > You're not linking to the boost_serialization library. At least on my system (Linux) boost::archive::{xml_,}archive_exception::what() is defined there. Add "-lboost_serialization" to your linker command or do the same through your build system. Note that Boost has #pragma lib ... to tell MSVC to link the required libraries. GCC does not have such a functionality. Ruben
------------------------------------------------------------------------------
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public