如何正确安装boost [英] how to install boost correctly
问题描述
我已经下载了boost_1_61_0
并解压缩了它.
我用bootstrap.bat
生成了b2.exe
和bjam.exe
,并成功在x64
和win32
的名为"stage"的文件夹中构建了库.
I've downloaded boost_1_61_0
and unzipped it.
I used bootstrap.bat
generating b2.exe
and bjam.exe
and successfully built libraries in a folder named "stage" for both x64
and win32
.
在具有包含文件的.lib
和boost
文件夹之后.
After I have .lib
and boost
folders containing include files.
当我删除根文件夹时,无法构建程序. 为什么我无法构建代码?
When I remove the root folder I can't build my program. Why am I unable to build the code?
我将bs用作:
b2 -j8 toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/x64 install
它将创建包含库和头文件的C:\boost
.但是,当我尝试在项目中使用此新文件夹时,出现错误:couldn't find eg: boost/reg.hpp
It creates C:\boost
that contains libs and header files. But when I try to use this new folder in my project I get errors: couldn't find eg: boost/reg.hpp
构建后是否有正确的方法来安装boost?
Is there a correct way to install boost after building it?
推荐答案
我想通了:
1-例如将boost_1_61_0提取到C :,因此将新文件夹命名为"C:\ boost_1_61_0"
1- extract boost_1_61_0 for example to C: so new folder named "C:\boost_1_61_0"
2-从命令提示符或Visual Studio 2015-> Visual Studio工具-> ms2015的开发人员命令提示符(以管理员身份运行)
2- from a command prompt or visual studio 2015-> Visual studio tools-> developer command prompt for ms2015 (run it as administrator)
3- cd C:\ boost_1_61_0
3- cd C:\boost_1_61_0
4- bootstrap.bat
4- bootstrap.bat
因此将创建新文件:根文件夹中的b2.exe和bjam.exe. 现在我们构建x64版本的boost库:
so new files are created: b2.exe and bjam.exe in the root folder. now we build the x64 version of boost library:
5- b2 -j8工具集= msvc-14.0地址模型= 64体系结构= x86链接=静态线程化=多个运行时链接=共享--build-type =最小阶段--stagedir = stage/x64
5- b2 -j8 toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/x64
-
新文件夹"Stage"在根文件夹中创建,该文件夹中有一个名为x64的文件夹,其中有一个文件夹"lib"(.lib文件).该过程需要几分钟(约20分钟)
new folder "Stage" is created in root folder, inside this folder there's a folder named x64 inside which there's a folder "lib" (.lib files). the process takes some minutes (about 20 minutes)
完成后,会显示一条消息,告诉您boost_1_61_0跳过了一些目标,不要介意这没什么,因为它属于其他操作系统
when it's done a message tells you that boost_1_61_0 skips some targets, don't mind it's nothing because it belongs to other OSs
现在我们构建x86版本:
now we build the x86 version:
b2 -j8工具集= msvc-14.0地址模型= 32体系结构= x86链接=静态线程化=多个运行时链接=共享--build-type =最小阶段--stagedir = stage/win32
b2 -j8 toolset=msvc-14.0 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=stage/win32
- 等到完成为止. 现在我们有x64和win32这两个版本,但是根文件夹太大了,大约5.3 GB.
- wait until it's done. now we have the two versions x64 and win32 but the root folder is too much big about 5.3 gigabyte.
现在我们将这两个库安装到"C:\ Boost",然后通过删除文件夹"C:\ boost_1_61_0"进行清理:
now we install these two libraries to "C:\Boost" and then clean by removing the folder "C:\boost_1_61_0":
b2 -j8工具集= msvc-14.0地址模型= 64体系结构= x86链接=静态线程化=多个运行时链接=共享--build-type =最小阶段--stagedir = C:\ Boost \ x64 install
b2 -j8 toolset=msvc-14.0 address-model=64 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=C:\Boost\x64 install
- 我添加安装并将文件夹名称从阶段更改为"C:\ Boost \ X64" 完成后,将创建一个新文件夹"C:\ Boost",其中包含include文件夹和包含lib文件的x64文件夹.
- I add install and changes the name of folder from stage to "C:\Boost\X64" when it's done a new folder "C:\Boost" is created it contains include folder and x64 folder which contains lib files.
现在我们安装win32版本: b2 -j8工具集= msvc-14.0地址模型= 32体系结构= x86链接=静态线程化=多运行时链接=共享--build-type =最小阶段--stagedir = C:\ Boost \ win32 install
now we install win32 version: b2 -j8 toolset=msvc-14.0 address-model=32 architecture=x86 link=static threading=multi runtime-link=shared --build-type=minimal stage --stagedir=C:\Boost\win32 install
- 完成后,在其中删除一个名为lib的文件夹:C:\ Boost \
- 该清理并释放内存的时间了:
- 删除孔文件夹:C:\ Boost_1_61_0,因为我们不再需要它
**如何在我的项目中添加增强功能?:
** how to add boost to my project?:
打开Msvc2015->创建c ++控制台新项目,创建后转到项目"-> "MyBoostProject的"属性-> C/C ++->常规->其他包含目录->编辑->新文件夹-> C:\ Boost \ include-> boost_1_61 添加另一个文件夹,其路径为:C:\ Boost \ include-> Boost_1_61_0-> Boost
open Msvc2015->create c++ console new project, when it's created go to Project-> "MyBoostProject's" properties->C/C++->General->Additional include directories->edit->new folder->C:\Boost\include->boost_1_61 add another folder with the path: C:\Boost\include->Boost_1_61_0->Boost
现在包含文件已准备就绪.
now the include files are ready.
**如何链接?:
如果我的项目是x86: 转到:链接器->常规->其他库目录->编辑->添加新文件夹-> C:\ Boost \ win32 \ Lib
if my project is x86: go to: linker->General->Additional Library Directories->edit->Add new folder->C:\Boost\win32\Lib
如果我的项目是x64:
if my project is x64:
链接器->附加库目录->编辑->添加新文件夹-> C:\ Boost \ x64 \ Lib
linker->Additional library directories->edit->add new folder->C:\Boost\x64\Lib
我希望这篇文章对任何无法安装的人都有用.
i wish this post would be useful for anyone who was not able to install it.
这篇关于如何正确安装boost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!