1、编译boost库ios
第一步:下载boost库,下载地址http://sourceforge.net/projects/boost/files/boost/1.55.0/git
第二部:解压boost库,例如解压到F:\Third-party libs\boost\boost_1_55_0bootstrap
第三部:开始->程序->MicrosoftVisual Studio 2010->Visual Studio Tools->Visual Studio 命令提示(2010),打开一个控制台测试
第四部:cd F:\Third-party libs\boost\boost_1_55_0ui
第五部:bootstrap.batspa
第六步:bjam.exe --toolset=msvc-10.0 --build-type=complete.net
2、测试环境code
第一步:建立一个工程,附加包含目录为:F:\Third-party libs\boost\boost_1_55_0;附加库目录为:F:\Third-party libs\boost\boost_1_55_0\stage\libblog
第二部:编写代码测试string
#include<iostream> #include <boost/regex.hpp> using namespace std; int main() { // 3 digits, a word, any character, 2 digits or "N/A", // a space, then the first word again boost::regex reg("\\d{3}([a-zA-Z]+).(\\d{2}|N/A)\\s\\1"); std::string correct="123Hello N/A Hello"; std::string incorrect="123Hello 12 hello"; assert(boost::regex_match(correct,reg)==true); assert(boost::regex_match(incorrect,reg)==false); cout<<"Hello Boost !"<<endl; }
第三部:编译运行,若是输出结果为:
则代表boost库在vs2010下配置成功。