我正在尝试编译一些源代码。但是它抛出了一些与 boost 库相关的错误。这是错误
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 regex 库,我使用 -L 选项给出了库的路径,并使用 -lboost_regex 选项指定了库。可能是什么问题?
它确实找到了图书馆。但是还是报错
最佳答案
我遇到了同样的问题,已经解决了。因此,也许您之前安装了旧版本的 boost,并且链接器链接了旧版本。
尝试删除所有已安装的boost库,并重新安装boost库,问题将得到解决。
关于c++ - boost库的编译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11001514/