Boost symbol not found

I am trying to compile / uninstall an older version of OpenOffice. It uses Boost v1.34.1, which is part of the source tree. The error message is as follows:

Undefined symbols: "boost::throw_exception(std::exception const&)", referenced from: boost::detail::shared_count::shared_count<ScToken>(ScToken*)in detfunc.o ld: symbol(s) not found 

Boost is new to me, and I could not find much online to help me figure this out. From the error message, I understand that I probably need to link the library. However, boost::throw_exception is defined in the header file without the corresponding library (which I can find). Just for bumps, I tried #include <boost/throw_exception.hpp> in detfunc and used symbolic links to not put the header file in the same directory without any luck.

Is there a library I should link to with -l or by including with -I ? How do I get this referenced symbol?

+6
source share
1 answer

Boost expects the project to be built with the BOOST_NO_EXCEPTIONS macro undefined, or to define the boost::throw_exception function boost::throw_exception .

From <boost/throw_exception.hpp> in version 1.34.1:

 namespace boost { #ifdef BOOST_NO_EXCEPTIONS void throw_exception(std::exception const & e); // user defined #else //[Not user defined --Dynguss] template<class E> inline void throw_exception(E const & e) { throw e; } #endif } // namespace boost 

Boost configuration headers determine whether to define a macro or not. It seems like it comes down to the compiler you use, but there may be other factors. Look in the boost/config/compiler/ folder for the header file matching your compiler, then find BOOST_NO_EXCEPTIONS in it. There should be some conditions around #define to help explain when Boost defines it. You may be able to customize your build to avoid the definition and pass by the linker error you are experiencing.

If you cannot change the compiler configuration to avoid the definition, you will probably leave boost::throw_exception(std::exception const & e) yourself somewhere in the OpenOffice code. I am not familiar with this code, so I cannot give a good suggestion where it should go.

+12
source

Source: https://habr.com/ru/post/908403/


All Articles