c++使用boost regex编译报错perl_matcher.hpp:382: undefined reference to `boost::re_detail_106100

来源:互联网 发布:少年心气 知乎 编辑:程序博客网 时间:2024/06/06 02:38

最近写的c++中用到了boost中的regex,但是make的时候老是报这个错误:

main.o: In function `boost::re_detail_106100::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::string>, __gnu_cxx::__normal_iterator<char const*, std::string>, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::string>)':/usr/local/include/boost/regex/v4/perl_matcher.hpp:382: undefined reference to `boost::re_detail_106100::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)'collect2: error: ld returned 1 exit statusmake: *** [spellingcheck] Error 1

查了半天发现同一台机器上因为有多个人使用,所以有多个人装boost,导致libboost_regex.a有多个版本,我的boost版本是1.64,有个人装了个1.61,莫名其妙的链接到了别人的库,编译的时候选择一个正确的版本就没问题了



阅读全文
0 0