boost window下安装

本文详细介绍了在Windows环境下使用命令行工具安装Boost库的过程,并提供了配置VS环境及使用示例,同时说明了如何通过宏控制库的链接方式。

boost  window下安装

window:

1、boost根目录运行 bootstrap.bat; 生成 bjam.exe

2、打开vs命令行,切换到boost目录,运行命令:bjam --toolset=msvc-10.0|msvc-9.0 --build_dir=D:/temp --stagedir=D:/boostsdkforwindows variant=release threading=multi link=static runtime-link=static

 

boost window下安装 - 蓝色火焰 - 水木博客

 

3、 命令执行完后,boost目录和boostsdkforwindows目录就是头文件和库文件,可以拷贝的所需的任意目录。

 

bjam --toolset=msvc-10.0 --build_dir=E:\temp --prefix=E:\boost1.55i --stagedir=E:\boostsdkforwindows --build-type=complete --with-atomic --with-chrono --with-context --with-coroutine --with-date_time --with-exception --with-filesystem --with-iostreams --with-locale --with-regex --with-system --with-thread --with-timer stage threading=multi


4、设定vs2010环境。(注:在2010环境下这步,在项目-->右键属性-->VC++ Directories 中去填写对应路径 )

修改环境变量:$(BOOST):  D:\boost\boost_1_46_0
Tools -> Options -> Projects and Solutions -> VC++ Directories 
在Library files加上$(BOOST)\bin\vc10\lib

在Include files加上$(BOOST)

使用举例:

#include<boost\thread.hpp>

此时,不用包含库文件,boost的auto-link机制将会自动帮我们包含对应的静态lib。也就是说,boost默认是以静态方式链接的,这样我们的工程属性最好也设为Multi-threaded (Debug)。如果想使用dll动态方式链接,需要预先定义宏:

#define BOOST_ALL_DYN_LINK

同样,此时boost也会默认帮我们包含对应的lib。如果不想使用boost提供的auto-link机制,或者对它的自动链接不太放心的话(其实大可不必担心),可以预先定义宏:

#define BOOST_ALL_NO_LIB

然后使用以下方法链接:

#pragma comment(lib, "boost_thread-vc100-mt-1_46.lib")或

#pragma comment(lib, "boost_thread-vc100-mt.lib")

这两个lib其实是一样的,实在不明白boost编译时为什么每个库都要复制一份,难道是因为后者在升级boost版本后不用改代码?另外还有一个比较有用的宏:

#define BOOST_LIB_DIAGNOSTIC

它可以让VC在编译时的output窗口中输出程序具体链接了哪些boost库以及链接顺序。

ABI tag: encodes details that affect the library's interoperability with other compiled code.  For each such feature, a single letter is added to the tag:

KeyUse this library when:Boost.Build option
slinking statically to the C++ standard library and compiler runtime support libraries.runtime-link=static
gusing debug versions of the standard and runtime support libraries.runtime-debugging=on
yusing a special debug build of Python.python-debugging=on
dbuilding a debug version of your code.variant=debug
pusing the STLPort standard library rather than the default one supplied with your compiler.stdlib=stlport
### 如何在 Windows安装 PCL (Point Cloud Library) #### 准备工作 为了成功安装 Point Cloud Library (PCL),需要准备一些必要的环境和工具。通常情况下,建议使用 Visual Studio 作为开发平台,并确保已安装 CMake 工具来配置编译过程。 #### 下载并解压 PCL 文件包 可以从官方网站下载适用于 Windows 的预编译二进制版本。对于不同版本的 PCL,路径可能会有所不同;例如,在较新的版本中,文件结构可能类似于 `C:\Program Files\PCL 1.14.0`[^2]。 #### 设置 VC++ 库目录 为了让项目能够找到所需的库文件,需设置 Visual Studio 中的 **VC++ 目录 -> 库目录**: - `C:\Program Files\PCL 1.14.0\lib` - `C:\Program Files\PCL 1.14.0\3rdParty\Boost\lib` - `C:\Program Files\PCL 1.14.0\3rdParty\FLANN\lib` - `C:\Program Files\PCL 1.14.0\3rdParty\OpenNI2\Lib` - `C:\Program Files\PCL 1.14.0\3rdParty\Qhull\lib` - `C:\Program Files\PCL 1.14.0\3rdParty\VTK\lib` 这些路径包含了构建应用程序所需的各种第三方库和支持文件[^3]。 #### 配置 Include 路径 同样重要的是要让编译器知道在哪里可以找到头文件。为此,还需向 **VC++ 目录 -> 包含目录** 添加以下条目: ```plaintext C:\Program Files\PCL 1.14.0\3rdParty\VTK\include\vtk-9.3 C:\Program Files\PCL 1.14.0\3rdParty\Qhull\include C:\Program Files\PCL 1.14.0\3rdParty\OpenNI2\Include C:\Program Files\PCL 1.14.0\3rdParty\FLANN\include C:\Program Files\PCL 1.14.0\3rdParty\Eigen3\include\eigen3 C:\Program Files\PCL 1.14.0\3rdParty\Boost\include\boost-1_84 C:\Program Files\PCL 1.14.0\include\pcl-1.14 ``` 这一步骤确保了所有的依赖项都能被正确识别和链接[^4]。 #### 测试安装 完成上述步骤之后,可以通过创建一个新的控制台应用来进行简单的测试,验证是否能顺利调用 PCL 功能。如果一切正常,则说明安装已经顺利完成。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值