boost 库的下载和编译_Visual Studio 2013(转)
原文转自 http://blog.csdn.net/lp310018931/article/details/47791143
原文转自 http://m.blog.csdn.net/article/details?id=42265605
Boost库是一个可移植、提供源代码的C++库,作为标准库的后备,是C++标准化进程的开发引擎之一。 Boost库由C++标准委员会库工作组成员发起,其中有些内容有望成为下一代C++标准库内容。在C++社区中影响甚大,是不折不扣的“准”标准库。Boost由于其对跨平台的强调,对标准C++的强调,与编写平台无关。大部分boost库功能的使用只需包括相应头文件即可,少数(如正则表达式库,文件系统库等)需要链接库。但Boost中也有很多是实验性质的东西,在实际的开发中实用需要谨慎。
1、首先到boost官网去下载最新版本的boost库,本人下载的是boost_1_64_0.zip:
2、解压后,以管理员方式在命令提示符下运行cmd, 进入 E:\WinClient\boost_1_64_0\目录,运行 bootstrap.bat批处理文件,运行后会在E:\WinClient\boost_1_64_0\目录中出现bjam.exe文件
3、然后在cmd中输入如下命令即可:
bjam.exe stage --toolset=msvc-12.0 --without-graph --without-graph_parallel --without-math --without-mpi --without-serialization --without-wave --without-test --without-program_options --without-serialization --without-signals --link=static runtime-link=static threading=multi debug release
等待程序编译完成,会在boost根目录下生成bin.v2和stage两个文件夹,其中bin.v2下是生成的中间文件,大小在2.7G左右,可以直接删除。stage下才是生成的dll和lib文件。
注意:如果编译时用下面的指令,则会生成所有的带s的库和不带s的库
bjam.exe stage --toolset=msvc-12.0 --build-type=complete --without-graph --without-graph_parallel --without-math --without-mpi --without-serialization --without-wave --without-test --without-program_options --without-serialization --without-signals
4、打开Visual Studio:
工程-->属性-->VC++目录:"包含目录(Include)": boost的根目录,例: D:\Visual Stdio 2013\lipeng\boost\boost_1_58_0
"库目录(Lib)": stage下的链接库目录,例:D:\Visual Stdio 2013\lipeng\boost\boost_1_58_0\stage\lib
通用属性->链接器->常规:"附加库目录":同上面的"库目录",例:D:\Visual Stdio 2013\lipeng\boost\boost_1_58_0\stage\lib
至此环境就配置好了,下面测试一下:
<span style="font-size:14px;"><pre name="code" class="cpp"><span style="font-family:Courier New;">#include <cstdlib> #include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <boost/thread.hpp>
#include <boost/timer.hpp>
#include <boost/progress.hpp> #include <libs/date_time/src/gregorian/greg_names.hpp>
#include <libs/date_time/src/gregorian/date_generators.cpp>
#include <libs/date_time/src/gregorian/greg_month.cpp>
#include <libs/date_time/src/gregorian/gregorian_types.cpp> #include <boost/date_time/posix_time/posix_time.hpp> using namespace boost; int main()
{
boost::timer t; boost::progress_display pd(); for (int i = ; i < ; ++i) //进度条
{
++pd;
} boost::gregorian::date dt(, , ); //date_time 库
assert(dt.year() == );
assert(dt.day() == );
boost::gregorian::date::ymd_type ymd = dt.year_month_day();
std::cout<<"\n"<<ymd.year<<"/"<<ymd.month<<"/"<<ymd.day<<" the day is "
<<dt.day_of_year() <<" days of this year"<< std::endl; std::cout << boost::gregorian::to_iso_extended_string(dt) << std::endl; //转换为其他格式
std::cout << boost::gregorian::to_iso_string(dt) << std::endl;
std::cout << boost::gregorian::to_simple_string(dt) << std::endl<<std::endl; //对数组排序操作
std::vector<int> test_vc();
std::vector<int>::iterator beg_it = test_vc.begin();
std::vector<int>::iterator end_it = test_vc.end();
std::srand(std::time(NULL)); std::for_each(beg_it, end_it, [](int& n){n = rand(); });
std::copy(beg_it, end_it, std::ostream_iterator<int>(std::cout, " "));
std::cout << std::endl << std::endl;
std::sort(beg_it, end_it, std::greater<int>());
std::copy(beg_it, end_it, std::ostream_iterator<int>(std::cout, " "));
std::cout << std::endl<<std::endl; boost::posix_time::ptime pt(boost::gregorian::date(, , )); std::cout << t.elapsed() << "s" << std::endl; //程序运行时间 system("pause"); return ;
}</span></span>
5、程序编译崩溃,解决方法是:安装VS2013的update5补丁包。
6、重新编译后,程序正确运行:
boost 库的下载和编译_Visual Studio 2013(转)的更多相关文章
- Opticks依赖库的下载和编译
最近下载Opticks的代码编译,用其自带的retrieve-dependencies.bat下载依赖库,总是提示缺少模块. 分析了一下错误原因,根据命令窗的提示,手动下载如下配置文件: https: ...
- 最近编译POCO 库和 Boost库的笔记
最近在编译POCO库和BOOST库 先讲一下编译POCO库,我编译的是1.9.0,过程相当曲折,要OPENSSL修改版本的,个OPENSSL在这里下载,如果你用一般未修改的OPENSSL 是编译不了, ...
- Win7下Boost库的安装
Boost库是C++领域公认的经过千锤百炼的知名C++类库,涉及编程中的方方面面,简单记录一下使用时的安装过程 1.boost库的下载 boost库官网主页:www.boost.org 2.安装 将下 ...
- 在Visual Sutdio 2017中使用boost库
在Visual Sutdio 2017中使用boost库 转载 https://blog.csdn.net/u011054333/article/details/78648294 对C++有一 ...
- VS2010下安装boost库
在我们的C++项目中安装boost库,下面以VS2010版本作为例子,其它版本的设置也差不多. 一.编译生成boost库 1.下载最新的boost(本人下载的是boost_1_56_0).boost官 ...
- mac下使用clion构建boost库
mac下使用clion构建boost库 使用brew install boost 完成后发现boost被安装在在/usr/local/Cellar/boost下 jetbrain给出的指导意见 htt ...
- Visual Studio 2013 RTM 中文语言包官方下载地址发布
如果你下载的是英文版,你想安装一个中文的visual studio 2013,那么你大可不必重新下载安装visual studio 2013,因为微软提供了Visual Studio 2013 RTM ...
- 新手,Visual Studio 2015 配置Boost库,如何编译和选择,遇到无法打开文件“libboost_thread-vc140-mt-gd-1_63.lib“的解决办法
1,到官网下载最新的boost,www.boost.org 这里我下载的1-63版本. 2,安装,解压后运行bootstrap.bat文件.稍等一小会就OK. 3,编译boost库.注意一定要使用VS ...
- 新手,Visual Studio 2013 配置Boost库,如何编译和选择
QuantLib installation in VC++ 2010 and later 参考:http://quantlib.org/install/vc10.shtml 1,到官网下载最新的boo ...
随机推荐
- 自动化运维工具——ansible系列命令
ansible-galaxy 连接 https://galaxy.ansible.com 下载相应的roles,此网站是Ansible爱好者将日常使用较好的playbooks打包上传,其他人可以免费下 ...
- 开发监测keepalived裂脑的脚本
检测思路:在备节点上执行脚本,如果可以ping通主节点并且备节点有VIP就报警,让人员介入检查是否裂脑. 在LB02备节点上开发脚本并执行: [root@lb02 ~]# cat /server/sc ...
- jQuery编码中的一些技巧
缓存变量 DOM遍历是昂贵的,所以尽量将会重用的元素缓存. // 糟糕 h = $('#element').height(); $('#element').css('height',h-20); // ...
- php中foreach循环遍历二维数组
最近在用tp3.2框架,在查询的时候用到了select(),这条语句返回的是二维数组,所以在对返回的数据做处理时,遇到了些麻烦,百度了下foreach,终于用foreach解决了数据的筛选问题 (因为 ...
- 并查集:HDU1213-How Many Tables(并查集最简单的应用)
How Many Tables Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tot ...
- Linux命令之---ls
命令简介: ls(list)命令用来列出目标目录(缺省的话为当前目录)中所有的子目录和文件. 指令所在路径:/bin/ls 执行权限:All User 命令语法: ls [选项] [目录名] 命令参数 ...
- Spring进阶-怎样集成定时调度Quartz
在一些项目里面比如进销存系统,对一些过期图片的定时清理或者库存不足发出预警提示,就需要用到定时调度技术. 每当经过一段时间,程序会自动执行,就是定时调度.如果要使用定时调度,则必须保证程序始终运行才行 ...
- Linux之匿名FTP服务器搭建
FTP(File Transfer Protocol)是在服务器与客户端进行文件传输的一种传输协议.本次介绍的是vsftpd的软件体验ftp服务. FTP服务器默认情况下依据用户登录情况分为三种不同的 ...
- Hive jdbc连接出现java.sql.SQLException: enabling autocommit is not supported
1.代码如下 String url = "jdbc:hive2://master135:10000/default"; String user = "root" ...
- load_file()与into outfile函数详解
load_file()函数的使用: 1.使用条件 ①有读取文件的权限 r and (select count(*) from mysql.user)>0 如果返回正常则说明有权限,反之没有 ②文 ...