原文转自 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:

http://www.boost.org/

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(转)的更多相关文章

  1. Opticks依赖库的下载和编译

    最近下载Opticks的代码编译,用其自带的retrieve-dependencies.bat下载依赖库,总是提示缺少模块. 分析了一下错误原因,根据命令窗的提示,手动下载如下配置文件: https: ...

  2. 最近编译POCO 库和 Boost库的笔记

    最近在编译POCO库和BOOST库 先讲一下编译POCO库,我编译的是1.9.0,过程相当曲折,要OPENSSL修改版本的,个OPENSSL在这里下载,如果你用一般未修改的OPENSSL 是编译不了, ...

  3. Win7下Boost库的安装

    Boost库是C++领域公认的经过千锤百炼的知名C++类库,涉及编程中的方方面面,简单记录一下使用时的安装过程 1.boost库的下载 boost库官网主页:www.boost.org 2.安装 将下 ...

  4. 在Visual Sutdio 2017中使用boost库

    在Visual Sutdio 2017中使用boost库     转载 https://blog.csdn.net/u011054333/article/details/78648294 对C++有一 ...

  5. VS2010下安装boost库

    在我们的C++项目中安装boost库,下面以VS2010版本作为例子,其它版本的设置也差不多. 一.编译生成boost库 1.下载最新的boost(本人下载的是boost_1_56_0).boost官 ...

  6. mac下使用clion构建boost库

    mac下使用clion构建boost库 使用brew install boost 完成后发现boost被安装在在/usr/local/Cellar/boost下 jetbrain给出的指导意见 htt ...

  7. Visual Studio 2013 RTM 中文语言包官方下载地址发布

    如果你下载的是英文版,你想安装一个中文的visual studio 2013,那么你大可不必重新下载安装visual studio 2013,因为微软提供了Visual Studio 2013 RTM ...

  8. 新手,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 ...

  9. 新手,Visual Studio 2013 配置Boost库,如何编译和选择

    QuantLib installation in VC++ 2010 and later 参考:http://quantlib.org/install/vc10.shtml 1,到官网下载最新的boo ...

随机推荐

  1. Python操作SQLLite(基本操作)

    SQLite 是一个软件库,实现了自给自足的.无服务器的.零配置的.事务性的 SQL 数据库引擎.SQLite 是在世界上最广泛部署的 SQL 数据库引擎.SQLite 源代码不受版权限制. Pyth ...

  2. Building a Space Station POJ - 2031

    Building a Space Station POJ - 2031 You are a member of the space station engineering team, and are ...

  3. 【Umezawa's Jitte】真正用起来svn来管理版本

    之前用过一次 但是没有真正的用起来 只是知道了一些基本概念 好了 决定开始真正的用这个svn了 参考大神http://www.cnblogs.com/wrmfw/archive/2011/09/08/ ...

  4. Altium Designer

    抗干扰设计原则: 1.电源线的设计 选择合适的电源 尽量加宽电源线 保证电源线.底线走向和数据传输方向一致 使用抗干扰元器件(磁珠.电源滤波器等) 电源入口添加去耦电容 2.底线的设计 模拟地和数字地 ...

  5. 如何使用DroidPlugin——DroidPlugin初体验

    最近研究了下360的黑科技--DroidPlugin 刚开始不知道怎么用,于是看了这篇博客:http://www.jianshu.com/p/f1217cce93ef  算是引导了我,于是开始自己写写 ...

  6. MoveWindow() SetWindowPos()的区别与联系

    敲代码时,突然发现有一个背景图片无法显示,百思不得其解,最终发现是MoveWindow() SetWindowPos()这两个函数的使用不当造成的. 这里把这两个函数的前世今生给分析一下. 先看Mov ...

  7. day05_08 列表讲解、切片、内置方法

      1.0 查询: a = ['wuchao','jinxing','xiaohu','sanpang','ligang'] print(a[3]) #>>>sanpang prin ...

  8. gcc学习记录2——多输入文件

    首先有两个.c文件:circle.c和circulararea.c. 分别对两个源文件生成目标文件,circle.o和circulararea.o. gcc -c circle.c circularr ...

  9. Selenium - WebDriver: Waits

    These days most of the web apps are using AJAX techniques. When a page is loaded to browser, the ele ...

  10. Selenium - WebDriver Advanced Usage

    Explicit Waits # Python from selenium import webdriver from selenium.webdriver.common.by import By f ...