0
我需要在我的程序中使用正则表达式匹配。我决定使用boost库,但在尝试编译时遇到奇怪的失败。哪里不对?? 有我的代码:Boost :: regex_match失败
...
#include <boost/regex.hpp>
...
using namespace boost;
...
map <string, double>::iterator container::find (string toFind)
{
iterator it;
for (it=mainMap.begin(); it!=mainMap.end(); it++)
{
regex e ((*it).first); //this line works correct
if (regex_match (toFind, e))
return it;
}
return it;
}
...
错误消息是大的发布,有它的开始:
TMP/cczkfDcy.o(.gnu.linkonce.t._ZN5boost11basic_regexIcNS_12regex_traitsIcEESaIcEED1Ev + 0×11): 在功能
boost::basic_regex<char, boost::regex_traits<char>, std::allocator<char> >::~basic_regex()': : undefined reference to
的boost :: reg_expression, 的std ::分配器> ::〜reg_expression()” ......
谢谢))它的工作原理! – 2012-03-24 11:43:49
你可以upvote并接受有用的答案 - http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work :) – 2012-03-24 13:07:31