最近开始看《精通正则表达式(第3版)》,里面提到了C/C++也有自己的正则表达式,但是该书介绍了Perl、Java、.NET、PHP……等语言的正则表达式的用法,唯独没有讲述C/C++语言中的正则表达式,于是去网上搜索了下,找到一个开源的C/C++正则表达式库——Boost
参照文章: VC6.0下配置Boost库使用正则表达式
进行一些配置,也写了测试用例,通过编译。
可能会遇到的问题:
1、
Regex_test.cpp
d:"boostl"boost"regex"v4"perl_matcher_common.hpp(767) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1794)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Command line warning D4028 : minimal rebuild failure, reverting to normal build
Error executing cl.exe.
Regex_test.exe - 1 error(s), 1 warning(s)

是因为你修改了程序,直接按“Ctrl+ F5运行程序,
修正方法:重新Rebuild下就OK
2、
Compiling...
Regex_test.cpp
Linking...
LINK : fatal error LNK1104: cannot open file "libboost_regex-vc6-sgd-1_34_1.lib"
Error executing link.exe.
Regex_test.exe - 1 error(s), 0 warning(s)

可能是是头文件的缘故
libboost_regex-vc6-sgd-1_34.lib中“libboost_regex-vc6-sgd-1_34的后面加“_1即可
其他的方法的库也应该也有这方面的问题。

由文章中讲述的配置过程,可以适用于VC++ 7.1(Visual Studio .NET 2003)以及VC++ 8.0(Visual Studio 2005)。
by 梦书

相关文章:

  • 2022-12-23
  • 2022-02-03
  • 2021-08-12
  • 2022-03-06
  • 2021-09-13
  • 2021-06-27
猜你喜欢
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案