我尝试使用 Boost 库但失败了,请参阅我的代码:
#include "listy.h"
#include <boost/regex.hpp>
using namespace boost;
ListyCheck::ListyCheck() {
}
ListyCheck::~ListyCheck() {
}
bool ListyCheck::isValidItem(std::string &__item) {
regex e("(\\d{4}[- ]){3}\\d{4}");
return regex_match(__item, e);
}
当我尝试编译它时,我收到了这些消息:
/usr/include/boost/regex/v4/regex_match.hpp:50: 未定义引用`boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator, std::allocator >>, std::allocator, std::allocator > > > >, boost::regex_traits >
::匹配()'
/usr/include/boost/regex/v4/basic_regex.hpp:425: 未定义对`boost::basic_regex > 的引用
::do_assign(char const*, char const*, unsigned int)'
/usr/include/boost/regex/v4/perl_matcher.hpp:366: 未定义引用`boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator, std::allocator >>, std::allocator, std::allocator > > > >, boost::regex_traits >
::construct_init(boost::basic_regex > > const&, boost::regex_constants::_match_flags)'
ETC...