编译包括一些常用库的编译(regex,datetime,random,system等)
编译步骤
1.下载boost
https://www.boost.org/
2 运行文件夹下 boostrap.bat (window)
3.cmd打开:bjam install –prefix=”E:\boost_1_69_0\vs2015″ –toolset=msvc-14.0 address-model=64 –with-system –with-date_time –with-random –with=-regex link=static runtime-link=static threading=multi
参数可以根据下面参考 编译出来的是2015上64位静态库
编译结果
【步骤3 参数解释】
BOOST_LIB_PREFIX + BOOST_LIB_NAME + “-” + BOOST_LIB_TOOLSET + “-” + BOOST_LIB_THREAD_OPT + “-” + BOOST_LIB_RT_OPT + “-” + BOOST_LIB_VERSION
这些定义为:
BOOST_LIB_PREFIX: 静态库为 “lib” (否则无,是用动态链接库)
BOOST_LIB_NAME: 库的基本名称 ( 比方说 boost_regex).
BOOST_LIB_TOOLSET: 编译工具集名称 ( 比如:vc6, vc7, bcb5 )
BOOST_LIB_THREAD_OPT: 多线程为 “-mt” ,否则为空
BOOST_LIB_RT_OPT: 指示使用的运行库的后缀,
组合下面的一个或者更多字符:
s 静态运行库,指的是静态链接到运行时库(不出现表示动态).
g 调试/诊断 runtime (release if not present).
d 调试版本 (不出现表示 release 版 ).
p STLPort 版本.
注:对 vc 来说,gd 总是一起出现
BOOST_LIB_VERSION: Boost 版本, Boost 版本 x.y 表示为 x_y形式.
编译:为了简化boost库的编译,boost库中带了一个用来编译的工具,名字是bjam.exe或者b2.exe.
1:运行boost下的bootstap.bat脚本就会自动生上述的两个编译工具,并且拷贝到boost目录下. 也可以进入tools/build目录下找到类似的脚本或者项目源码来编译.
2: bjam.exe的参数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bjam.exe –toolset=msvc-10.0 –with-date_time runtimelink=static link=static stage
意思是要生静态库,该静态库静态链接C运行时库
生成的文件名字是:libboost_date_time-vc100-mt-sgd-1_48.lib(debug version),libboost_date_time-vc100-mt-s-1_48.lib(release version) 两个文件.
bjam.exe –toolset=msvc-10.0 –with-date_time runtimelink=shared link=static stage
意思是要生静态库,该静态库动态链接C运行时库
生成的文件名字是:libboost_date_time-vc100-mt-gd-1_48.lib(debug verion),libboost_date_time-vc100-mt-1_48.lib(release version) 两个文件.
bjam.exe –toolset=msvc-10.0 –with-date_time runtimelink=shared link=shared stage
意思是要生动态库,该动态库动态链接C运行时库
生成的文件名字是:boost_date_time-vc100-mt-gd-1_48.lib(debug version),boost_date_time-vc100-mt-1_48.lib(release version) 两个文件.
生成的dll名字是:boost_date_time-vc100-mt-gd-1_48.dll(debug version),boost_date_time-vc100-mt-1_48.dll(release version)