greta 编译,配置,使用

http://blog.csdn.net/is2120/article/details/7207178
正则表达式 regular expression greta vc6 compile 2008 2010
1. greta 在 vc6下能顺利编译
greta 2.64. (最后的版本已不存在vc6和vc6之外的区别了,作者最后合并到一起了)

2. 使用 vs2008 (visual studio 2008) 编译会出现以下这些错误:
2.1 具体错误
error C2923: 'regex::hetero_stack<AlignmentT,RuntimeTypeCheckT,AssumePodT,DynamicBlockSizeT,StaticBlockSizeT>::aligned_sizeof' : 'regex::hetero_stack<AlignmentT,RuntimeTypeCheckT,AssumePodT,DynamicBlockSizeT,StaticBlockSizeT>::stack_node::header' is not a valid template type argument for parameter 'T' restack.h    355

//z 2012-1-17 3:09 PM IS2120@CSDN
2.2 解决方案
byte_t      m_buf[ aligned_sizeof<stack_node::header>::no_rtti + StaticBlockSizeT ];
-->
stack_node::header 前面添加上 typename 即可

2.3 去除其他的警告
在" Project Properties -> Configuration Properties -> C\C++ -> Preprocessor -> Preprocessor Definitions"中添加宏" _SCL_SECURE_NO_WARNINGS"
_CRT_SECURE_NO_DEPRECATE

3. 使用 visual studio 2010 编译
会遇上编译错误,主要原因是
template< bool f > struct static_assert;
template<>         struct static_assert<true> { static_assert() {} };

主要是因为 static_assert 在 visual studio 2010 已经是一个保留关键字了。。。

1>restack.h(56): error C2332: 'struct' : missing tag name
1>restack.h(56): error C3306: 'regex::detail::<unnamed-tag>': unnamed class template is not allowed
1>restack.h(56): error C2143: syntax error : missing ';' before 'static_assert'
1>restack.h(56): error C2059: syntax error : ';'
1>restack.h(57): error C2332: 'struct' : missing tag name
1>restack.h(57): error C2143: syntax error : missing ';' before 'static_assert'
1>restack.h(57): error C2913: explicit specialization; 'regex::detail::<unnamed-tag>' is not a specialization of a class template
1>restack.h(57): error C2059: syntax error : '<'
1>restack.h(57): error C2143: syntax error : missing ';' before '{'
1>restack.h(57): error C2447: '{' : missing function header (old-style formal list?)


3.1 解决了这个问题之后,发现出出现linked error
暂无法解决(已解决,详见3.2)
 : error LNK2019: unresolved external symbol "protected: void __thiscall regex::basic_rpattern_base<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class regex::perl_syntax<wchar_t> >::_common_init(enum regex::REGEX_FLAGS)" (?_common_init@?$basic_rpattern_base@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@V?$perl_syntax@_W@regex@@@regex@@IAEXW4REGEX_FLAGS@2@@Z) referenced in function "protected: __thiscall regex::basic_rpattern_base<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class regex::perl_syntax<wchar_t> >::basic_rpattern_base<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class regex::perl_syntax<wchar_t> >(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &,enum regex::REGEX_FLAGS,enum regex::REGEX_MODE)" (??0?$basic_rpattern_base@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@V?$perl_syntax@_W@regex@@@regex@@IAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@W4REGEX_FLAGS@1@W4REGEX_MODE@1@@Z)
 : error LNK2019: unresolved external symbol "unsigned int __cdecl regex::detail::DEFAULT_BLOCK_SIZE(void)" (?DEFAULT_BLOCK_SIZE@detail@regex@@YAIXZ) referenced in function "protected: __thiscall regex::detail::basic_rpattern_base_impl<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >::basic_rpattern_base_impl<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >(enum regex::REGEX_FLAGS,enum regex::REGEX_MODE,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (??0?$basic_rpattern_base_impl@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@detail@regex@@IAE@W4REGEX_FLAGS@2@W4REGEX_MODE@2@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@2@Z)
 : error LNK2019: unresolved external symbol "public: static bool __cdecl regex::detail::regex_access<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >::_do_match_with_stack(class regex::detail::basic_rpattern_base_impl<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >> const &,struct regex::detail::match_param<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > &,bool)" (?_do_match_with_stack@?$regex_access@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@detail@regex@@SA_NABV?$basic_rpattern_base_impl@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@23@AAU?$match_param@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@23@_N@Z) referenced in function "public: static bool __cdecl regex::detail::regex_access<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >::_do_try_match<class std::allocator<class regex::backref_tag<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > > >(class regex::detail::basic_rpattern_base_impl<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > const &,struct regex::detail::match_param<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > &,class std::vector<class regex::backref_tag<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >,class std::allocator<class regex::backref_tag<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > > > &,bool)" (??$_do_try_match@V?$allocator@V?$backref_tag@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@regex@@@std@@@?$regex_access@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@detail@regex@@SA_NABV?$basic_rpattern_base_impl@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@12@AAU?$match_param@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@12@AAV?$vector@V?$backref_tag@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@regex@@V?$allocator@V?$backref_tag@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@regex@@@std@@@std@@_N@Z)
 : error LNK2019: unresolved external symbol "public: static bool __cdecl regex::detail::regex_access<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >::_do_match_impl(class regex::detail::basic_rpattern_base_impl<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > const &,struct regex::detail::match_param<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > &,bool)" (?_do_match_impl@?$regex_access@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@detail@regex@@SA_NABV?$basic_rpattern_base_impl@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@23@AAU?$match_param@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@23@_N@Z) referenced in function "public: static bool __cdecl regex::detail::regex_access<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >::_do_try_match<class std::allocator<class regex::backref_tag<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > > >(class regex::detail::basic_rpattern_base_impl<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > const &,struct regex::detail::match_param<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > &,class std::vector<class regex::backref_tag<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >,class std::allocator<class regex::backref_tag<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > > > &,bool)" (??$_do_try_match@V?$allocator@V?$backref_tag@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@regex@@@std@@@?$regex_access@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@detail@regex@@SA_NABV?$basic_rpattern_base_impl@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@12@AAU?$match_param@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@12@AAV?$vector@V?$backref_tag@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@regex@@V?$allocator@V?$backref_tag@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@regex@@@std@@@std@@_N@Z)
 : error LNK2019: unresolved external symbol "protected: bool __thiscall regex::detail::basic_rpattern_base_impl<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >::_ok_to_recurse(void)const " (?_ok_to_recurse@?$basic_rpattern_base_impl@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@detail@regex@@IBE_NXZ) referenced in function "public: static bool __cdecl regex::detail::regex_access<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >::_do_try_match<class std::allocator<class regex::backref_tag<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > > >(class regex::detail::basic_rpattern_base_impl<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > const &,struct regex::detail::match_param<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > &,class std::vector<class regex::backref_tag<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >,class std::allocator<class regex::backref_tag<class std::_String_const_iterator<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > > > &,bool)" (??$_do_try_match@V?$allocator@V?$backref_tag@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@regex@@@std@@@?$regex_access@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@detail@regex@@SA_NABV?$basic_rpattern_base_impl@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@12@AAU?$match_param@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@12@AAV?$vector@V?$backref_tag@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@regex@@V?$allocator@V?$backref_tag@V?$_String_const_iterator@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@regex@@@std@@@std@@_N@Z)


http://blog.csdn.net/is2120/article/details/7207178

3.2 解决编译错误
//z 2012-1-18 10:46 AM IS2120@CSDN
今天研究了下这个链接错误,将 greta.lib 加入搜索路径就可以了。(为啥vc6以及vs2008都能正确处理project dependency而vs2010不能了?)
(adding "greta.lib" to lib's searching path can resolve this issue)

3.3 其他:输出详细的编译链接信息,这样有利于错误的排除
生成的lib文件也可以输出到相应的会被用到的地方。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值