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.解壓后打開(kāi)目錄
\boost_1_35_0\boost_1_35_0\libs\regex\build編譯vc6下版本vc6.mak文件,具體如下:
a。打開(kāi)dos環(huán)境,把vc6目錄中的Microsoft Visual Studio\VC98\Bin下的VCVARS32.BAT拖入dos窗做環(huán)境設(shè)置。
b。運(yùn)行namke -f vc6.mak。
c。把生成的dll和lib放在自己的目錄中,最好在vc6的vc98下建一個(gè)目錄,畢竟是vc6下的編譯碼。然后在vc6中設(shè)置包含lib file。
文件include包含目錄 boost_1_35_0\boost_1_35_0\boost_1_35_0
3.測(cè)試,粘貼到vc中直接編譯。
如果編譯出現(xiàn)minimal builder不支持的話,則去掉set中的minimal builder勾選。
還有若出現(xiàn)類似fatal error C1001: INTERNAL COMPILER ERROR錯(cuò)誤的話,則采用rebuilder來(lái)重建,一般是可以通過(guò)。
為啥為什么出現(xiàn)這個(gè)內(nèi)部編譯錯(cuò)誤,倒不清楚。不過(guò),不影響vc下的正則處理使用暫時(shí)不管了。
#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