vs2010下 boost库的使用笔记(一)
来源:互联网 发布:淘宝返利网是什么意思 编辑:程序博客网 时间:2024/05/16 06:27
- #include <boost/lambda/lambda.hpp>
- #include <iostream>
- #include <iterator>
- #include <algorithm>
- int main()
- {
- using namespace boost::lambda;
- typedef std::istream_iterator<int> in;
- std::for_each(
- in(std::cin), in(), std::cout << (_1 * 3) << " " );
- }
前面已经简单的使用了boost库,但是如果想要使用
- Boost.Filesystem
- Boost.GraphParallel
- Boost.IOStreams
- Boost.MPI
- Boost.ProgramOptions
- Boost.Python (see the Boost.Python build documentation before building and installing it)
- Boost.Regex
- Boost.Serialization
- Boost.Signals
- Boost.System
- Boost.Thread
- Boost.Wave
等,还是的编译一下,要不然就会出现如下的错误“LINK : fatal error LNK1104: 无法打开文件“libboost_regex-vc100-mt-gd-1_46_1.lib”
打开命令行窗口
切换到 boost库的根目录。
我的是E:/mylib/boost_1_46_1
输入bootstrap
然后有几行输出
再输入./bjam
类库编译开始(这个真是个漫长的过程 ………………)
哎 等了 1个小时了
还得等
再编译一会儿吧
N久之后 编译好了
ln-NT stage/lib/libboost_unit_test_framework-vc100-mt.lib
"NT symlinks not supported yet, making copy"
已复制 1 个文件。
ln-NT stage/lib/libboost_thread-vc100-mt.lib
"NT symlinks not supported yet, making copy"
已复制 1 个文件。
ln-NT stage/lib/libboost_wave-vc100-mt.lib
"NT symlinks not supported yet, making copy"
已复制 1 个文件。
...updated 786 targets...
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
E:/mylib/boost_1_46_1
The following directory should be added to linker library paths:
E:/mylib/boost_1_46_1/stage/lib
用如下代码替换上一次的那个example.cpp的内容
- #include <boost/regex.hpp>
- #include <iostream>
- #include <string>
- int main()
- {
- std::string line;
- boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );
- while (std::cin)
- {
- std::getline(std::cin, line);
- boost::smatch matches;
- if (boost::regex_match(line, matches, pat))
- std::cout << matches[2] << std::endl;
- }
- }
在工程中添加库引用
属性>连接器>常规 > 附加目录库 这里写入 E:/mylib/boost_1_46_1/stage/lib
编译
运行
输入
To: George ShmidlapFrom: Rita MarloweSubject: Will Success Spoil Rock Hunter?
输出
Will Success Spoil Rock Hunter?
一个简单的正则表达式编译成功。
至此,boost库编译成功。
- In Configuration Properties > Linker > Additional Library Directories, enter the path to the Boost binaries, e.g. C:/Program Files/boost/boost_1_46_1/lib/.
- From the Build menu, select Build Solution.
- vs2010下 boost库的使用笔记(一)
- vs2010下 boost库的使用笔记(一)
- 关于Boost库在VS2010下的编译使用(转)
- 关于Boost库在VS2010下的编译使用(转)
- VS2010下安装和使用boost库
- VS2010下安装使用boost库
- VS2010下安装和使用boost库
- vs2010下编译使用boost
- VS2010下的boost配置
- VS2010下安装boost库
- VS2010下安装boost库
- VS2010下安装boost库
- VS2010下安装boost库
- VS2010下安装boost库
- VS2010下安装boost库
- VS2010下安装boost库
- VS2010下安装boost库
- VS2010下安装boost库
- $.each() 中的 continue、break
- AE+C#将E00数据导入到ArcSDE中去
- WebRTC音视频引擎研究(2)--VoiceEngine音频编解码器数据结构以及参数设置
- mysql 高效的update
- NoSQL之Redis高级应用--发布及订阅消息
- vs2010下 boost库的使用笔记(一)
- WebRTC VoiceEngine使用简单Demo
- 2013大连海事大学腾讯编程马拉松div2第二场部分题解
- HDFS 原理、架构与特性介绍
- NSString中去除空格
- swap space
- Spring MVC 传递参数
- Linux平台下WebRTC音视频获取(Javascript API)
- 14-5(3)统计电话号码和QQ中同数字出现的个数