在使用未定义的符号升压:regex_error在C ++?(Undefined symbol whi

2019-10-17 03:33发布

我使用升压库正则表达式,我用的boost ::正则表达式()函数编译正则表达式。 我要赶这个函数调用抛出的异常。 所以,我用boost:regex_error渔获()。

但是,使用此功能提供了以下错误:

undefined symbol: _ZTIN5boost11regex_errorE

什么是上述错误的原因是什么?

Answer 1:

您有链接boost_regex 。 在GCC,添加-lboost_regex到链接器调用。 其他编译器将具有同等的选择。



Answer 2:

$ c++filt _ZTIN5boost11regex_errorE
typeinfo for boost::regex_error

因此,所属类别缺失。 我想你应该编译启用RTTI(运行时类型信息)项目。

要么

克++未定义参照所属类别



文章来源: Undefined symbol while using boost:regex_error in C++?
标签: c++ boost