我从微软的站点下载了greta模版库,然后直接在程序中引用,并将greta的几个文件COPY到该项目的目录下。#include "stdafx.h"
#include <iostream>
#include <string>
#include "regexpr2.h"using namespace std;
using namespace regex;int _tmain(int argc, _TCHAR* argv[])
{
match_results results;
string str( "The book cost $12.34" );
rpattern pat( "\\$(\\d+)(\\.(\\d\\d))?" ); // Match a dollar sign followed by one or more digits,
// optionally followed by a period and two more digits.
// The double-escapes are necessary to satisfy the compiler. match_results::backref_type br = pat.match( str, results ); if( br.matched )
{
cout << "match success!" << endl;
cout << "price: " << br << endl;
}
else
{
cout << "match failed!" << endl;
}
return 0;
}然后编译,提示下列错误。textrx error LNK2019: 无法解析的外部符号 "protected: bool __thiscall regex::detail::basic_rpattern_base_impl<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator>::_ok_to_recurse(void)const " (?_ok_to_recurse@?$basic_rpattern_base_impl@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@detail@regex@@IBE_NXZ) ,该符号在函数 "public: static bool __cdecl regex::detail::matcher_helper<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator>::_do_try_match<class std::allocator<class regex::backref_tag<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> > >(class regex::detail::basic_rpattern_base_impl<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> const &,struct regex::detail::match_param<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> &,class std::vector<class regex::backref_tag<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator>,class std::allocator<class regex::backref_tag<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> > > &,bool)" (??$_do_try_match@V?$allocator@V?$backref_tag@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@regex@@@std@@@?$matcher_helper@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@detail@regex@@SA_NABV?$basic_rpattern_base_impl@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@12@AAU?$match_param@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@12@AAV?$vector@V?$backref_tag@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@regex@@V?$allocator@V?$backref_tag@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@regex@@@std@@@s请问这是什么问题,需要把greta编译成LIB文件吗?如何编译?
#include <iostream>
#include <string>
#include "regexpr2.h"using namespace std;
using namespace regex;int _tmain(int argc, _TCHAR* argv[])
{
match_results results;
string str( "The book cost $12.34" );
rpattern pat( "\\$(\\d+)(\\.(\\d\\d))?" ); // Match a dollar sign followed by one or more digits,
// optionally followed by a period and two more digits.
// The double-escapes are necessary to satisfy the compiler. match_results::backref_type br = pat.match( str, results ); if( br.matched )
{
cout << "match success!" << endl;
cout << "price: " << br << endl;
}
else
{
cout << "match failed!" << endl;
}
return 0;
}然后编译,提示下列错误。textrx error LNK2019: 无法解析的外部符号 "protected: bool __thiscall regex::detail::basic_rpattern_base_impl<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator>::_ok_to_recurse(void)const " (?_ok_to_recurse@?$basic_rpattern_base_impl@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@detail@regex@@IBE_NXZ) ,该符号在函数 "public: static bool __cdecl regex::detail::matcher_helper<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator>::_do_try_match<class std::allocator<class regex::backref_tag<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> > >(class regex::detail::basic_rpattern_base_impl<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> const &,struct regex::detail::match_param<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> &,class std::vector<class regex::backref_tag<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator>,class std::allocator<class regex::backref_tag<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> > > &,bool)" (??$_do_try_match@V?$allocator@V?$backref_tag@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@regex@@@std@@@?$matcher_helper@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@detail@regex@@SA_NABV?$basic_rpattern_base_impl@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@12@AAU?$match_param@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@12@AAV?$vector@V?$backref_tag@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@regex@@V?$allocator@V?$backref_tag@Vconst_iterator@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@regex@@@std@@@s请问这是什么问题,需要把greta编译成LIB文件吗?如何编译?
解决方案 »
- visual studio 2010 怎么看堆栈?
- 求 类似qq登陆下拉列表效果实例
- UDP接收端CPU过高
- 写入串口失败
- CWebBrowser2控件问题,求助高手!--猛给分,在线等
- 在试图中显示标尺,并能实现标尺刻度的调整在放大视图中的曲线时。
- 关于句柄的获得方法,大虾们请进
- CEDIT控件设置了自动换行后,为什么在输入"*""+"等字符后总会跳行?
- 如何在TreeCtrl中显示透明ICON图标(万分火急)
- 有谁知道JAVA编程思想上哪里下载?
- 如果我想让程序在保存是生成一个abc.line的文件,该怎么弄?
- 请问谁知当点击左边时出现在右边以表的形式显示数据库里的内容 ,在VC6.0里能不能通过直接在对话框里放工具面板里的Tree Control,和List
你需要把其中的cpp文件加到你的project里面去
哪位有比较成功的经验。
其它的我试过,可以。