提升库的编译问题

Compilation issue with boost library

本文关键字:编译 问题      更新时间:2023-10-16

我正在尝试编译一些源代码。但是,它抛出了一些与提升库相关的错误。这是错误

undefined reference to `boost::re_detail::get_mem_block()'
main.cpp:(.text+0x40a6): undefined reference to `boost::re_detail::verify_options(unsigned int, boost::regex_constants::_match_flags)'
main.cpp:(.text+0x40db): undefined reference to `boost::re_detail::put_mem_block(void*)'
main.cpp:(.text+0x430a): undefined reference to `boost::re_detail::put_mem_block(void*)'
main.o: In function `_ZN7Command12createVectorIdEEvRKSsRSt6vectorIT_SaIS4_EES4_.constprop.1207':
main.cpp:(.text+0x436e): undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)'
main.cpp:(.text+0x439f): undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)'
main.cpp:(.text+0x43d0): undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<

我的系统中安装了 boost 正则表达式库,并且我使用 -L 选项提供了库的路径,并使用 -lboost_regex 选项指定了库。可能是什么问题?

它确实找到了库。但仍然抛出错误

我遇到了同样的问题,它已经解决了。因此,也许您之前已经安装了旧版本的boost,并且链接器链接了旧版本。

尝试删除所有已安装的提升库,然后重新安装提升库,您的问题将得到解决。