boost 的安装

vc8 下用到boost 类库,没找到安装的办法,google 了一下,找到了一些介绍安装的方法,比如 http://hi.baidu.com/atry/blog/item/46950ad738c635dca044dff0.html

然后我傻乎乎的按照他的方法去做,结果装了我 2 个小时,在c盘留下了 2G多的垃圾文件。

后来我想boost的类库应该是可以单独安装的,而我的项目中用到的仅仅是regex的部分,最终在<uncompress dir>\boost_1_34_0\libs\regex\下面找到了一个index.html文件,上面写明了安装regex类库的方法。 翻译如下(英文一半,所以附上原文):

Microsoft Visual C++ 6, 7, 7.1 and 8

You need version 6 of MSVC to build this library. If you are using VC5 then you may want to look at one of the previous releases of this library
Open up a command prompt, which has the necessary MSVC environment variables defined (for example by using the batch file Vcvars32.bat installed by the Visual Studio installation), and change to the <boost>\libs\regex\build directory.

你需要版本6的msvc去编译这个类库。如果你是使用vc5的拥护,请察看之前发布的版本 library打开一个命令行窗口,前提是你的msvc环境变量已经被定义(例如使用Vcvars32.bat安装,Vcvars32.bat这个文件在你的vc安装目录下),然后改变路径到<boost>\libs\regex\build

Select the correct makefile - vc6.mak for "vanilla" Visual C++ 6 or vc6-stlport.mak if you are using STLPort.

选择正确的makefile文件, 例如 你使用的是vc6,请选择vc6.mak,如果是使用STLPort请使用vc6-stlport.mak文件

Invoke the makefile like this:

调用makefile命令如下:

nmake -fvc6.mak

You will now have a collection of lib and dll files in a "vc6" subdirectory, to install these into your development system use:

这样你将会有一个包含有lib和dll文件的vc6子文件夹的集合,安装这些道你的开发环境中:

nmake -fvc6.mak install

The lib files will be copied to your <VC6>\lib directory and the dll files to <VC6>\bin, where <VC6> is the root of your Visual C++ 6 installation.

You can delete all the temporary files created during the build (excluding lib and dll files) using:

lib文件将会被复制到你的 <VC6>\lib目录下,dll文件会被复制到<VC6>\bin目录下,<VC6>是你的Visual C++ 6.0的安装目录

你可以删除在编译时产生的临时文件(多余的lib和dll文件):

nmake -fvc6.mak clean 

If you want to build with ICU support, then you need to pass the path to your ICU directory to the makefile, for example with:

如果你想编译能支持ICU,你需要指明ICU路径给makefile,例如:

nmake ICU_PATH=c:\open-source\icu -fvc71.mak install

Finally when you use regex++ it is only necessary for you to add the <boost> root directory to your list of include directories for that project. It is not necessary for you to manually add a .lib file to the project; the headers will automatically select the correct .lib file for your build mode and tell the linker to include it.

最后当你使用regex类库的时候,你只需要给你的项目添加<boost>到你的include目录下,他不需要你手动去添加.lib文件去项目,头文件会自动选择正确的.lib文件给你的编译器,告诉连接器去include它。

Note that if you want to dynamically link to the regex library when using the dynamic C++ runtime, define BOOST_REGEX_DYN_LINK when building your project.

如果你想动态编连regex类库,定义BOOST_REGEX_DYN_LINK当编译你的项目的时候。(应该是在stdafx.h头文件中定义BOOST_REGEX_DYN_LINK,添加如下代码:

#define BOOST_REGEX_DYN_LINK)

If you want to add the source directly to your project then define BOOST_REGEX_NO_LIB to disable automatic library selection.

如果你想直接添加源代码到你的项目中,请定义:BOOST_REGEX_NO_LIB 来禁止自动选择类库。

There are several important caveats to remember when using boost.regex with Microsoft's Compiler:

对于使用Microsoft 产品的编译者,这里有几条重要的警告:

  • There have been some reports of compiler-optimization bugs affecting this library, (particularly with VC6 versions prior to service patch 5) the workaround is to build the library using /Oityb1 rather than /O2. That is to use all optimization settings except /Oa. This problem is reported to affect some standard library code as well (in fact I'm not sure if the problem is with the regex code or the underlying standard library), so it's probably worthwhile applying this workaround in normal practice in any case.
  • 有一些会报告编译选项bug,(特别是使用VC6 service patch 5之前的用户),工作区编译这些库使用/Oityb1而不是/O2。那是用了所有的优化设置,除了/Oa.这个问题被报告还影响到一些标准类库代码(实际上,我不是很确定这些是regex代码的问题还是下面标准类库德问题),所以,她可能值得应用这些工作区在普通的项目中。
  • If you have replaced the C++ standard library that comes with VC6, then when you build the library you must ensure that the environment variables "INCLUDE" and "LIB" have been updated to reflect the include and library paths for the new library - see vcvars32.bat (part of your Visual Studio installation) for more details.
  • 如果你覆盖来自vc6的c++标准类库,你必须确定"INCLUDE" and "LIB"环境变量已经映射到你新的类库的路径-请察看vcvars32.bat
  • If you are building with the full STLPort v4.x, then use the vc6-stlport.mak file provided and set the environment variable STLPORT_PATH to point to the location of your STLPort installation (Note that the full STLPort libraries appear not to support single-thread static builds).
  • 如果你完全使用STLPort v4.x 编译,使用vc6-stlport.mak文件,设置STLPORT_PATH环境变量指定你的 STLPort安装目录(注意:full STLPort类库不支持single-thread static编译)
  • If you are building your application with /Zc:wchar_t then you will need to modify the makefile to add /Zc:wchar_t before building the library.
  • 如果你编译你的项目使用 /Zc:wchar_t选项,你需要在编译它之前修改makefile 增加/Zc:wchar_t

相信你知道怎么做了吧,unicode的用户请注意最后一条: 如果你编译你的项目使用 /Zc:wchar_t选项,你需要在编译它之前修改makefile 增加
/Zc:wchar_t

你可能感兴趣的:(C++,c,C#,Microsoft,vc++)