欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

VS2019配置BOOST的方法(v1.70.0庫)

 更新時(shí)間:2020年08月05日 09:57:14   作者:RiskAI  
這篇文章主要介紹了VS2019配置BOOST的方法(v1.70.0庫),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

安裝編譯Boost c++ library

安裝Boost庫

官網(wǎng)下載:https://www.boost.org/users/history/version_1_70_0.html

最新版本1.70.0. (低于1.7.0的版本可能在vs2019中支持不完善,編譯或運(yùn)行時(shí)發(fā)生不可預(yù)料的bug)

下載好后,解壓,得到文件目錄如下圖,找到其中的bootstrap.bat文件:


雙擊運(yùn)行可能出現(xiàn)閃退,最好的辦法(親測有效): 選擇vs2019 —> visual studio tools —> vc —> x86_x64 Cross Tools Command Prompt for VS 2,打開命令行:



切換到boost_1_70_0的安裝目錄,(本人安裝路徑:E:\program\boost_1_70_0)

cd E:\program\boost_1_70_0
bootstrap.bat # 執(zhí)行

執(zhí)行會發(fā)現(xiàn)當(dāng)前文件夾中增加了幾個(gè)文件,找到其中的bjam.exe,如下圖所示


命令行執(zhí)行:

bjam.exe --toolset=msvc-14.1 architecture=x86 address-model=64 link=static --build-type=complete --with-system --with-thread --with-date_time --with-filesystem --with-serialization

Note:

MSVC 版本號對應(yīng)

1.MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
2.MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
3.MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
4.MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)
5.MSVC++ 9.0  _MSC_VER == 1500 (Visual Studio 2008)
6.MSVC++ 8.0  _MSC_VER == 1400 (Visual Studio 2005)
7.MSVC++ 7.1  _MSC_VER == 1310 (Visual Studio 2003)
8.MSVC++ 7.0  _MSC_VER == 1300
9.MSVC++ 6.0  _MSC_VER == 1200
10.MSVC++ 5.0  _MSC_VER == 1100

vs2019 可以支持boost c++ library 針對msvc-14.1的編譯選項(xiàng)

等待5-10min即可完成。

最后兩個(gè)路徑會在使用Boost庫時(shí)工程屬性中包含目錄和庫目錄中用到。

The Boost C++ Libraries were successfully built.
the following directory should be added to compiler include paths:
E:\program\boost_1_70_0
the following directory should be added to linker library paths:
E:\program\boost_1_70_0\stage\lib

這時(shí)boost庫已經(jīng)安裝、編譯成功。

新建vs2019 c++項(xiàng)目,并添加boost依賴庫

點(diǎn)擊菜單欄 項(xiàng)目——>屬性——>選擇VC++目錄,在包含目錄 和 庫目錄添加以上2個(gè)路徑,如下圖:


或可以新建一個(gè)系統(tǒng)環(huán)境變量BOOST_DIR,值為E:\program\boost_1_70_0。

在path系統(tǒng)環(huán)境變量中添加:%BOOST_DIR%;

VC++包含目錄中添加: %BOOST_DIR%;

VC++庫目錄中添加: %BOOST_DIR%\stage\lib;

代碼測試

#include <boost/lexical_cast.hpp>   
#include <iostream>  

using namespace std;
using namespace boost;

int main()
{
	//system("chcp 65001");

	double a = lexical_cast<double>("3.1415926");
	string str = lexical_cast<string>("3.1415926");
	cout << "This is a number: " << a << endl;
	cout << "This is a string: " << str << endl;
	int b = 0;
	try {
		b = lexical_cast<int>("neo");
	}
	catch (bad_lexical_cast& e) {
		cout << e.what() << endl;
	}
	return 0;
}

運(yùn)行輸出(正常):

This is a number: 3.14159
This is a string: 3.1415926
bad lexical cast: source type value could not be interpreted as target

c++ boost庫說明

c++ boost庫官網(wǎng)

官網(wǎng)最新版文檔說明:https://www.boost.org/doc/libs/1_70_0/

refer: 百度百科

Boost庫是一個(gè)可移植、提供源代碼的C++庫,作為標(biāo)準(zhǔn)庫的后備,是C++標(biāo)準(zhǔn)化進(jìn)程的開發(fā)引擎之一,是為C++語言標(biāo)準(zhǔn)庫提供擴(kuò)展的一些C++程序庫的總稱。 Boost庫由C++標(biāo)準(zhǔn)委員會庫工作組成員發(fā)起,其中有些內(nèi)容有望成為下一代C++標(biāo)準(zhǔn)庫內(nèi)容。在C++社區(qū)中影響甚大,是不折不扣的“準(zhǔn)”標(biāo)準(zhǔn)庫。Boost由于其對跨平臺的強(qiáng)調(diào),對標(biāo)準(zhǔn)C++的強(qiáng)調(diào),與編寫平臺無關(guān)。大部分boost庫功能的使用只需包括相應(yīng)頭文件即可,少數(shù)(如正則表達(dá)式庫,文件系統(tǒng)庫等)需要鏈接庫。但Boost中也有很多是實(shí)驗(yàn)性質(zhì)的東西,在實(shí)際的開發(fā)中使用需要謹(jǐn)慎。

Boost庫由Boost社區(qū)組織開發(fā)、維護(hù)。其目的是為C++程序員提供免費(fèi)、同行審查的、可移植的程序庫。Boost庫可以與C++標(biāo)準(zhǔn)庫完美共同工作,并且為其提供擴(kuò)展功能。Boost庫使用Boost License來授權(quán)使用。

Boost社區(qū)建立的初衷之一就是為C++的標(biāo)準(zhǔn)化工作提供可供參考的實(shí)現(xiàn),Boost社區(qū)的發(fā)起人Dawes本人就是C++標(biāo)準(zhǔn)委員會的成員之一。在Boost庫的開發(fā)中,Boost社區(qū)也在這個(gè)方向上取得了豐碩的成果。在送審的C++標(biāo)準(zhǔn)庫TR1中,有十個(gè)Boost庫成為標(biāo)準(zhǔn)庫的候選方案。在更新的TR2中,有更多的Boost庫被加入到其中。從某種意義上來講,Boost庫成為具有實(shí)踐意義的準(zhǔn)標(biāo)準(zhǔn)庫。
可下載Boost C++ Libraries安裝boost庫。大部分boost庫功能的使用只需包括相應(yīng)頭文件即可,少數(shù)(如正則表達(dá)式庫,文件系統(tǒng)庫等)需要鏈接庫。里面有許多具有工業(yè)強(qiáng)度的庫,如graph庫。

主要分類

按照功能分類的Boost庫列表
按照實(shí)現(xiàn)的功能,Boost 可為大致歸入以下20個(gè)分類,在下面的分類中,有些庫同時(shí)歸入幾種類別。
字符串和文本處理
a) Conversion
b) Format
c) IOStream
d) Lexical Cast
e) Regex
f) Spirit
g) String Algo
h) Tokenizer
i) Wave
j) Xpressive

容器
a) Array
b) Bimap
c) Circular Buffer
d) Disjoint Sets
e) Dynamic Bitset
f) GIL
g) Graph
h) ICL
i) Intrusive
j) Multi-Array
k) Multi-Index
l) Pointer Container
m) Property Map
n) Property Tree
o) Unordered
p) Variant

迭代器
a) GIL
b) Graph
c) Iterators
d) Operators
e) Tokenizer

算法
a) Foreach
b) GIL
c) Graph
d) Min-Max
e) Range
f) String Algo
g) Utility

函數(shù)對象和高階編程
a) Bind
b) Function
c) Functional
d) Functional/Factory
e) Functional/Forward
f) Functional/Hash
g) Lambda
h) Member Function
i) Ref
j) Result Of
k) Signals
l) Signals2
m) Utility

泛型編程
a) Call Traits
b) Concept Check
c) Enable If
d) Function Types
e) GIL
f) In Place Factory, Typed In Place Factory
g) Operators
h) Property Map
i) Static Assert
j) Type Traits

模板元編程

a) Function Types
b) Fusion
c) MPL
d) Proto
e) Static Assert
f) Type Traits

預(yù)處理元編程
a) Preprocessors

并發(fā)編程

a) Asio
b) Interprocess
c) MPI
d) Thread

數(shù)學(xué)和數(shù)字

a) Accumulators
b) Integer
c) Interval
d) Math
e) Math Common Factor
f) Math Octonion
g) Math Quaternion
h) Math/Special Functions
i) Math/Statistical Distributions
j) Multi-Array
k) Numeric Conversion
l) Operators
m) Random
n) Rational
o) uBLAS

排錯(cuò)和測試

a) Concept Check
b) Static Assert
c) Test

數(shù)據(jù)結(jié)構(gòu)

a) Any
b) Bitmap
c) Compressed Pair
d) Fusion
e) ICL
f) Multi-Index
g) Pointer Container
h) Property Tree
i) Tuple
j) Uuid
k) Variant

圖像處理

a) GIL

輸入輸出

a) Asio
b) Assign
c) Format
d) IO State Savers
e) IOStreams
f) Program Options
g) Serialization

跨語言混合編程

a) Python

內(nèi)存管理

a) Pool
b) Smart Ptr
c) Utility

解析
a) Spirit

編程接口
a) Function
b) Parameter

雜項(xiàng)
a) Compressed Pair
b) Conversion
c) CRC
d) Date Time
e) Exception
f) Filesystem
g) Flyweight
h) Lexical Cast
i) Meta State Machine
j) Numeric Conversion
k) Optional
l) Polygon
m) Program Options
n) Scope Exit
o) Statechart
p) Swap
q) System
r) Timer
s) Tribool
t) Typeof
u) Units
v) Utility
w) Value Initialized

編譯器問題的變通方案

a) Compatibility
b) Config

常用庫

  • Regex
  • 正則表達(dá)式庫
  • Spirit
  • LL parser framework,用C++代碼直接表達(dá)EBNF
  • Graph
  • 圖組件和算法
  • Lambda
  • 在調(diào)用的地方定義短小匿名的函數(shù)對象,很實(shí)用的functional功能
  • concept check
  • 檢查泛型編程中的concept
  • Mpl
  • 用模板實(shí)現(xiàn)的元編程框架
  • Thread
  • 可移植的C++多線程庫
  • Python
  • 把C++類和函數(shù)映射到Python之中
  • Pool
  • 內(nèi)存池管理
  • smart_ptr
  • 5個(gè)智能指針,學(xué)習(xí)智能指針必讀,一份不錯(cuò)的參考是來自CUJ的文章:

相關(guān)圖書編輯

  • Boost程序庫完全開發(fā)指南:深入C++“準(zhǔn)”標(biāo)準(zhǔn)庫
  • C++11/14高級編程:Boost程序庫探秘(第3版)
  • Boost程序庫探秘:深度解析C++準(zhǔn)標(biāo)準(zhǔn)庫

到此這篇關(guān)于VS2019配置BOOST的方法(v1.70.0庫)的文章就介紹到這了,更多相關(guān)VS2019配置BOOST內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論