Linux下: C++代码 2
./bjam --build-type=minimal
--with-date_time
--with-filesystem
--with-program_options
--with-regex
--with-serialization
--with-system
--with-thread
variant=release
link=static threading=multi stage
./bjam --build-type=minimal
--with-date_time
--with-filesystem
--with-program_options
--with-regex
--with-serialization
--with-system
--with-thread
variant=release
link=static threading=multi 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,里面为所有的头文件和库文件。头文件目录为boost_1_34_1\boost目录复制过去的。
2.只编译相应的库文件 bjam --toolset=msvc stage 完成后同样会生成bin.v2临时目录。另一个目录为stage文件,里面有对应的库文件。
3.查看需要编译才能使用的库列表 bjam --show-libraries
4.编译特定的库,如只编译regex bjam --toolset=msvc --with-regex stage 生成的库文件在stage目录中。
5.不编译某个库,如不编译regex bjam --toolset=msvc --without-regex stage 生成的库文件在stage目录中。
6.编译特定的库,如只编译regex,生成debug,多线程,共享连接版本,并保存在stage。 bjam --toolset=msvc --with-regex stage debug threading=multi link=shared
7.生成 mt-sgd 的静态库(runtime-link-static) 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=single link=shared link=static runtime-link=shared runtime-link=static boost的安装方法: 对于DLL版本 bjam --toolset=msvc link=shared runtime-link=shared