编译boost库编译方法

boost库  时间:2021-01-26  阅读:()

bo o s t库编译方法(zz)

Window s下:

C++代码

 bjam.exe --build-type=min imal --w ith-date_time --w ith-filesystem

--w ith-program_options --w ith-regex --w ith-s erializat ion --w ith-system --w ith-threadtoolset=msvc-9.0 variant=release link=static threading=multi stagebjam.exe --build-type=m in imal --with-date_time --with-filesystem --with-program_options--with-regex --with-serialization --with-system--with-thread toolset=msvc-9.0 variant=releaselink=static threading=multi stage

Linux下:

C++代码

 ./bjam--build-type=m in imal --w ith-date_time --w ith-filesystem--with-program_options

--with-regex --with-serialization --with-system --with-thread variant=release link=staticthreading=mu lti s tage

./bjam --build-type=minimal --with-date_time --with-filesystem --with-program_options--with-regex --with-serialization --with-system --with-thread variant=release link=staticthreading=mu lti stage

:-)

////////////////////////////////////////////////

许多新人对于编译BOOST感到无从下手甚至因此而放弃使用BOOST那真的太可惜了下面我把一些常用的BOOST编译方法贴于此 同时也作为自己的笔记。

首先下载bjam.exe复制到$BOOST$ 目录下。或者自己生成bjam打开Visual Studio 2008命令提示窗口$BOOST$\tools\jam\src执行build.bat会在$BOOST$\tools\jam\src\bin.ntx86生成bjam.exe文件。复制文件bjam.exe 文件到$BOOST$\下。

1.完全编译安装bjam--toolset=msvc install

完成后会生成一个bin.v2编译时的临时目录手动删除。生成另一个目录C:\boost里面为所有的头文件和库文件。头文件目录为b o o s t_1_34_1\b o os t目录复制过去的。

2.只编译相应的库文件bjam--toolset=msvc stage

完成后同样会生成bin.v2临时目录。另一个目录为stage文件里面有对应的库文件。

3.查看需要编译才能使用的库列表bjam--show-libraries

4.编译特定的库如只编译regexbjam--toolset=msvc--with-regex stage

生成的库文件在stage目录中。

5.不编译某个库如不编译regexbjam--toolset=msvc--without-regex stage

生成的库文件在stage目录中。

6.编译特定的库如只编译regex生成debug多线程共享连接版本并保存在stage。bjam--toolset=msvc--with-regex stage debug threading=multi link=shared

7.生成mt-s gd的静态库(runtime-link-s tatic)bjam"-sTOOLS=vc-8_0" --with-thread install debug release runtime-link=static

8.编译regex库。bjam --toolset=msvc --with-regex stage debug release threading=multi threading=singlelink=shared link=static runtime-link=shared runtime-link=staticboost的安装方法

对于DLL版本bjam--toolset=msvc link=shared runtime-link=shared threading=multi stage debug release install对于lib版本bjam--toolset=msvc link=static runtime-link=shared threading=multi stage debug release install另外在$BO OST$\tools\build\v2\user-config.jam找到下面的地文

#-------------------

#MSVC configuration.

#-------------------

#Configure msvc (default version, searched for in standard locations and PATH).

#using msvc;

#Configure specific msvc version(searched for in standard locations and PATH).

#using msvc :8.0;

#在这里添加vs2008的配置using msvc : 9.0 : : /wd4819 /D_CRT_SECURE_NO_DEPRECATE/D_SCL_SECURE_NO_DEPRECAT E /D_SECURE_SCL=0;

#在这里添加vs2005的配置using msvc : 8.0 : : <compileflags>/wd4819<c ompileflags>/D_CRT_SECURE_NO_DEPRECAT E

<compileflags>/D_SCL_SECURE_NO_DEP RECATE<compileflags>/D_SECURE_SCL=0;然后进入$BOOST$ 目录执行bjam.exe编译命令

//下面的命令的各选项的说明

//prefix 将boost安装到的路径生成的头文件和库文件都会放到该路径中。

//重定义以下变量利用-s设置

//VC80_ROOT vc2005的安装路径如果未将vc2005安装到默认位置你必须指定该项。//TOOLS 使用的编译工具 vc2005对应的是vc-8_0

//PYTHON_ROOT ython的安装目录如果未将BOOST安装到默认位置你必须指定该项。

//BUILD 编译结果选项默认会生成尽可能多的版本如调试版发行版静态库动态库单线程多线程。bjam命令说明

Boost.Build V2(Milestone 12)

Boost.Jam 03.1.16

Project-specific help:

Project has jamfile at Jamroot

Usage:

bjam[options] [properties] [install|stage]

Builds and installs Boost.

Targets and Related Options:install Installheaders and compiled library files to the======= configured locations (below).

--prefix=<PREFIX> Install architecture independent files here.Default;C:\Boost on Win32

Default; /usr/loc al on Unix.Linux, etc.--exec-prefix=<EPREFIX>Install architecture dependent files here.Default;<PREFIX>

--libdir=<DIR> Install library files here.

Default;<EPREFIX>/lib

--includedir=<HDRDIR> Install header files here.

Default;<PREFIX>/includestage Buildandinstallonlycompiledlibraryfiles===== to the stage directory.

--stagedir=<STAGEDIR> Install library files here

Default; ./stage

Other Options:

--build-type=<type> Build the specified pre-defined set of variationsof the libraries.Note, that which variants getbuilt depends on what each library supports.minimal (default) -Builds the single"release"version of the libraries.Thisrelease corresponds to specifying:"releas e<threading>mu lti<link>shared<link>static<runtime-link>shared"as theBoost.Build variant to build.complete-Attempts to build all possiblevariations.

--build-dir=DIR Build in this location instead of buildingwithin the distribution tree.Rec ommended!--show-libraries Displays the list of Boost libraries that requirebuild and installation steps, then exit.--layout=<layout> Determines whether to choose library namesand header locations such that multipleversions of Boost or multiple compilers canbe used on the same system.versioned(default) -Names of boostbinaries include the Boost versionnumber and the name and version of thecompiler. Boost headers are installedin a subdirectory of<HDRDIR>whosename contains the Boost version

numb er.system-Binaries names do not includethe Boost version number or the nameand version number of the c ompiler.

Boost headers are installed directlyinto<HDRDIR>. This option isintended for system integrators whoare building distribution packages.

--buildid=ID Adds thespecified ID to the name of builtlibraries. The default is to not add anything.

--help This message.

--with-<library> Build and install the specified<library>

If this option is used,only librariesspecified using this option will be built.

--without-<library> Do not build, stage,or install the specified

<library>.By default,all libraries are built.

Properties:toolset=toolset Indicates the toolset to build with.variant=debug|release Select the build variantlink=static|shared Whether to build static or shared librariesthreading=single|multi Whether to build single or multithreaded binariesruntime-link=s tatic|shared

Whether to link to static or shared C and C++runtime.Configuration help:

Configuration file at$boost$\tools\build\v2user-config.jam

This file is used to configure your Boost.Build installation.You can modifythis file in place,or you can place it in a permanent location so that itdoes not get overwritten should you get a new version of Boost.Build. See:http://boost.org/boost-build2/doc/html/bbv2/referenc e.html#bbv2.referenc e.initfor documentation about possible permanent locations.

General c ommand line usage:bjam[options] [properties] [targets]

Options,properties and targets can be specified in any order.

Important Options:

*--clean Remove targets instead of building

*-a Rebuild everyth ing

*-n Don't execute the commands,only print them

*-d+2 Show commands as they are executed

*-d0 Supress all informational messages

*-q Stop at first error

*--debug-c onfiguration Diagnos e c onfiguration

*--debug-building Report which targets are built with what properties

*--debug-generator Diagnose generator search/execution

Further Help:

The following options can be used to obtain additional documentation.

*--help-options Print more obscure command line options.

*--help-internal Boost.Build implementation details.

*--help-doc-options Implementation details doc formatting.

编译所有版本:bjam--tools et=msvc-8.0--prefix=$lib-and-dll-out-dir$--build-type=c omplete install

等待编译完成.

设置开发环境:

打开VS2005选择工具->选项->vc++目录

设置包含文件目录$lib-and-dll-out-dir$\inc lude\boost-1_37\boost

设置引用文件目录:$lib-and-dll-out-dir$\lib

完成.可以使用了.

在vs2010下编译boostboost最新版本1.44已经支持vs2010然而直接下载编译会发现一堆bug

首先由bootstrap编译bjam的时候就会碰钉子典型的错误就是

Failed to build Boost.Jam build engine.

Please consult bjam.log for furter diagnostics.

查看bjam.log后可以发现里面的错误信息command.c :fatal error C1033:cannot open program database' '

Technorati标签:boost,c++,编译,vs2010

这个问题在于一个vs编译环境。默认我们都直接进入cmd进行编译在vs2010环境下这个是行不通的。

其次的错误就是通过bjam编译boo st库的时候会发现编译过程中出现很多fatal很多库编译不成功

解决办法

 在开始菜单中Microsoft Visual Studio 2010\Visual Studio Tools下运行Visual Studio

Command Prompt(2010)通过这个cmd进入boost的目录进行bjam的编译以及运行bjam

编译boost

搞定bjam后在Visual Studio Command Prompt (2010)下直接运行bjam--tools et=msvc-10.0 --w ith-date_time --w ith-program_options --w ith-system--w ith-thread--w ith-filesystem--w ith-test--w ith-regex--w ith-crypto--w ith-s erializat ion

然后就可以去喝咖啡了

HostKvm(4.25美)香港和俄罗斯高防机房云服务器

HostKvm 商家我们算是比较熟悉的国内商家,商家主要还是提供以亚洲数据中心,以及直连海外线路的服务商。这次商家有新增香港和俄罗斯两个机房的高防服务器方案。默认提供30GB防御,且目前半价优惠至4.25美元起步,其他方案的VPS主机还是正常的八折优惠。我们看看优惠活动。香港和俄罗斯半价优惠:2021fall,限购100台。通用优惠码:2021 ,八折优惠全部VPS。我们看看具体的套餐。1、香港高...

GreenCloudVPS$20/年,新加坡/美国/荷兰vps/1核/1GB/30GB,NVMe/1TB流量/10Gbps端口/KVM

greencloudvps怎么样?greencloudvps是一家国外主机商,VPS数据中心多,之前已经介绍过多次了。现在有几款10Gbps带宽的特价KVM VPS,Ryzen 3950x处理器,NVMe硬盘,性价比高。支持Paypal、支付宝、微信付款。GreenCloudVPS:新加坡/美国/荷兰vps,1核@Ryzen 3950x/1GB内存/30GB NVMe空间/1TB流量/10Gbps...

阿里云年中活动最后一周 - ECS共享型N4 2G1M年付59元

以前我们在参与到云服务商促销活动的时候周期基本是一周时间,而如今我们会看到无论是云服务商还是电商活动基本上周期都要有超过一个月,所以我们有一些网友习惯在活动结束之前看看商家是不是有最后的促销活动吸引力的,比如有看到阿里云年中活动最后一周,如果我们有需要云服务器的可以看看。在前面的文章中(阿里云新人福利选择共享性N4云服务器年79.86元且送2月数据库),(LAOZUO.ORG)有提到阿里云今年的云...

boost库为你推荐
盗版win8.1升级win10电脑预装正版win8,后来装成盗版win8.1了,请问还能不能升级win10呀百度空间首页怎样登录百度博客天玑1000plus和骁龙865哪个好天玑720和骁龙765g哪个好?手机浏览器哪个好手机浏览器哪个好用网络机顶盒哪个好什么牌子的网络机顶盒最好什么叫dns服务器DNS服务器是什么东东?360云盘转存百度云盘360云盘文件如何快速转存到百度云360云盘下载速度慢怎么办请问现在有没有人在用手机360云盘,为什么手机端下载速度会怎么慢,我的网速很快。360云盘下载速度慢怎么办360网盘上传速度好慢,怎么解决?360云盘下载速度慢怎么办360云盘下载速度慢怎么办
免费二级域名注册 vps优惠码cnyvps evssl 免费静态空间 北京主机 免费全能空间 dux ftp教程 北京双线机房 合租空间 爱奇艺会员免费试用 智能dns解析 实惠 可外链的相册 免备案cdn加速 xshell5注册码 htaccess ncp是什么 美国vpn代理 建站论坛 更多