1.這里下載boots,http://downloads.sourceforge.net,我下載的是boost_1_35_0.zip,鏈接如下:
http://downloads.sourceforge.net/boost/boost_1_35_0.zip?modtime=1206795434&big_mirror=0
2.解壓后打開目錄
\boost_1_35_0\boost_1_35_0\libs\regex\build編譯vc6下版本vc6.mak文件,具體如下:
a。打開dos環境,把vc6目錄中的Microsoft Visual Studio\VC98\Bin下的VCVARS32.BAT拖入dos窗做環境設置。
b。運行namke -f vc6.mak。
c。把生成的dll和lib放在自己的目錄中,最好在vc6的vc98下建一個目錄,畢竟是vc6下的編譯碼。然后在vc6中設置包含lib file。
文件include包含目錄 boost_1_35_0\boost_1_35_0\boost_1_35_0
3.測試,粘貼到vc中直接編譯。
如果編譯出現minimal builder不支持的話,則去掉set中的minimal builder勾選。
還有若出現類似fatal error C1001: INTERNAL COMPILER ERROR錯誤的話,則采用rebuilder來重建,一般是可以通過。
為啥為什么出現這個內部編譯錯誤,倒不清楚。不過,不影響vc下的正則處理使用暫時不管了。
#include "stdafx.h"
#include <boost/regex.hpp>
#include <string>
#include <iostream>
using namespace std;
using namespace boost;
regex ee("a+b");
int main()
{
string str = "aaaaaaab";
if(regex_match(str.c_str(), ee))
{
cout<<"match ok"<<endl;
}
getchar();
return 0;
}
備注原文:http://dotnet.csdn.net/page/66e7a1c1-981e-4609-93fc-a3c34a6a5308