boost mingw 编译

来源:互联网 发布:由丑变漂亮.知乎 编辑:程序博客网 时间:2024/04/29 09:41

http://www.cppblog.com/xinus/archive/2011/03/01/140854.aspx


在windows下,添加的库文件为libabc.dll,eclipse cdt 中在project的setting里library的-l选项值为“abc”


  1. Download Boost from http://www.boost.org/users/download (version 1.40 or higher)
  2. Extract the boost files to a path BOOST_ROOT of your choice
  3. Open a command prompt and cd to the BOOST_ROOT directory (make sure that mingw/bin is in your path)
  4. Go to BOOST_ROOT/tools/jam/src and execute build gcc to build jam
  5. Copy bjam.exe to BOOST_ROOT by calling copy bin.ntx86\bjam.exe ..\..\..
  6. Go back to BOOST_ROOT and run bjam.exe --with-thread --with-filesystem --with-system --with-program_options --with-date_time --with-regex --prefix=.\ --layout=tagged toolset=gcc variant=release install (this can take a while)
  7. Create a new environment variable BOOST_ROOT containing the root path of your Boost installation

转自http://www.360doc.com/content/11/0323/14/59141_103855056.shtml

【Boost】 在Windows下编译Boost
 
文章分类:C++编程
这系列文章将逐一介绍Boost库的具体内容。首先我们从Boost在Windows下编译开始讲解。 

对于大部分Boost应用来说,它是不用编译的,直接包含头文件就可使用,如: 
anyarrayasioconversioncrcbind/mem_fnenable_iffunctionlambdamplsmart_pt


只有少部分需要编译成库文件,需要编译的库如下: 
date_timefilesystemfunction_typesgraphiostreamsmathmpiprogram_optionspythonregexserializationsignalssystemtestthreadwave


要完全编译boost库需要先准备一些第三方库: 

1. Regex所需Unicode支持类库 -- ICU 
编译ICU较为简单,解开ICU包之后,在其目录下可以找到一个叫"allinone"的目录,用Visual studio或者visual studio express打开里面的allinone.sln,选择release,即可以编译完成,编译之后,将include目录和release目录下的库文件拷贝出来,分别放在C:\icu\include和C:\icu\lib. 

2. Graph所需的Xml处理类库 --Expat, 将该自解压文件解压到C:\expat即可。 

3.Boost.MPI所需MPI类库 -- Boost的官方站点说需要MPICH或OpenMPI之类的支持,事实上在Windows下总是会提示需要MPIC++,事实上你需要的是Microsoft Cluster Pack SDK,下载并默认安装在c:\Program Files\Microsoft Compute Cluster Pack下。 

这里我遇到两个问题,一并说一下: 

如果下载的是Microsoft HPC Pack 2008 SDK,或者Microsoft Compute ClusterPack不是装到默认的路径下,那bjam就会抓瞎,找不到mpic++的路径,这时候可以修改一下mpi.jam(在tools\build\v2\tools): 
local cluster_pack_path_native = "你的路径" ;



现在完全编译Boost所需要的类库都准备好了。 

增加mpi的编译需要在路径...BoostDir\tools\build\v2\user-config.jam
文件中增加一行
using mpi ;