找不到升压符号 [英] Boost symbol not found

查看:24
本文介绍了找不到升压符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译/移植旧版本的 OpenOffice.它使用 Boost v1.34.1,它是源代码树的一部分.错误信息如下:

I'm trying to compile/port 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 对我来说是新的,我在网上找不到太多东西来帮助我理解这一点.从错误消息中,我了解到我可能需要链接一个库.但是, boost::throw_exception 是在没有匹配库(我可以找到)的头文件中定义的.只是为了踢球,我在 detfunc 中尝试了 #include <boost/throw_exception.hpp> 并使用符号链接将头文件放在同一目录中,但没有运气.

Boost is new to me, and I haven't been able to find much online to help me understand this. From the error message, I understand that I probably need to link a library. However, boost::throw_exception is defined in a header file with no matching library (that I can find). Just for kicks, I've tried #include <boost/throw_exception.hpp> in detfunc and using symbolic links to put the header file in the same directory with no luck.

是否有我应该使用 -l 链接的库或使用 -I 链接的包含路径?我应该如何获得该符号的引用?

Is there a library I should be linking with -l or an include path with -I? How should I get that symbol referenced in?

推荐答案

Boost 希望项目要么使用未定义的宏 BOOST_NO_EXCEPTIONS 构建,要么定义函数 boost::throw_exception 本身.

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

来自 1.34.1 版:

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 的配置头文件将决定是否定义宏.看起来归结为您使用的编译器,但可能还有其他因素.在 boost/config/compiler/ 文件夹中查看与您的编译器对应的头文件,然后在其中搜索 BOOST_NO_EXCEPTIONS.在 #define 周围应该有一些条件来帮助解释 Boost 何时定义它.您可以配置您的构建以避免定义并解决您遇到的链接器错误.

Boost's configuration headers will determine whether to define the macro or not. It looks like it boils down to the compiler you're using, but there may be other factors. Take a look in the boost/config/compiler/ folder for the header file that corresponds to your compiler, then search for BOOST_NO_EXCEPTIONS in it. There should be some conditions around the #define to help explain when Boost defines it. You may be able to configure your build to avoid the definition and get past the linker error you're experiencing.

如果您无法更改编译器配置以避免定义,那么您可能需要自己定义 boost::throw_exception(std::exception const & e)OpenOffice 代码.不过,我不熟悉该代码,所以我无法给出一个好的建议.

If you're unable to change your compiler config to avoid the definition, then you're probably left defining boost::throw_exception(std::exception const & e) yourself somewhere in the OpenOffice code. I'm unfamiliar with that code, though, so I can't give a good suggestion where it should go.

这篇关于找不到升压符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆