最近在开发关键字过滤的程序,需要用到正则表达式,选择了GRETA。
Greta在http://research.microsoft.com/projects/greta/可以下载,许多介绍都是关于lib的,不推荐直接加入到项目
加入到VC7.1中,也许会碰到一些问题,不要理会它,也别企图修改Greta的代码 :)
预编译头
不需要 #include "stdafx.h" 到 regexpr2.cpp 和syntax2.cpp
选择项目 - 属性 - C/C++ - 预编译头 - 选择 不使用预编译头
LNK2019错误
lsp error LNK2019: 无法解析的外部符号 __CrtDbgReport ,该符号在函数
"
protected: bool __thiscall regex::basic_rpattern_base<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator,class regex::perl_syntax<char> >::_find_next(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::iterator &,class regex::detail::match_group_base<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> *,class regex::perl_syntax<char> &,class std::vector<class regex::detail::match_group_base<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> *,class std::allocator<class regex::detail::match_group_base<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::const_iterator> *> > &)
"
(
?
_find_next@
?
$basic_rpattern_base@Vconst_iterator@
?
$basic_string@DU
?
$char_traits@D@std@@V
?
$allocator@D@
2
@@std@@V
?
$perl_syntax@D@regex@@@regex@@IAE_NAAViterator@
?
$basic_string@DU
?
$char_traits@D@std@@V
?
$allocator@D@
2
@@std@@PAV
?
$match_group_base@Vconst_iterator@
?
$basic_string@DU
?
$char_traits@D@std@@V
?
$allocator@D@
2
@@std@@@detail@
2
@AAV
?
$perl_syntax@D@
2
@AAV
?
$vector@PAV
?
$match_group_base@Vconst_iterator@
?
$basic_string@DU
?
$char_traits@D@std@@V
?
$allocator@D@
2
@@std@@@detail@regex@@V
?
$allocator@PAV
?
$match_group_base@Vconst_iterator@
?
$basic_string@DU
?
$char_traits@D@std@@V
?
$allocator@D@
2
@@std@@@detail@regex@@@std@@@
5
@@Z) 中被引用
照样修改项目属性:
项目 -- 属性 -- C/C++ -- 代码生成 -- 运行时库 选择 多线程调试 DLL (/MDd)
选择/MDd就不会错了:)
如何下载
Greta的下载地址:
GRETA 2.6.4 for VC7/VC7.1
http://research.microsoft.com/downloads/download.asp?FUID={BD99F343-4FF4-4041-8293-34C054EFE749}
Download GRETA 2.6.4 for VC6
http://research.microsoft.com/downloads/download.asp?FUID={DFDF2354-5BF5-495B-B7CF-1396CC975EE8}
VC++ PowerTools
http://www.gotdotnet.com/team/cplusplus/powertools/powertools.zip
VC++ PowerTools包含greta源代码,但其包包含了其它东西,过大,如果您只是下载Greta的话,就别下这个了:)
还有问题?
如果还有啥问题,可以先问我,再去问Ashish Aggarwal和Chris Quirk :)