您的位置:首页 > 数据库 > Mongodb

mongodb C++驱动VS2012编译

2016-03-16 14:59 337 查看

1、安装scons
(1) 下载python2.7, 使用x86_32位,因为scons只有32位安装包可用;
(2) 下载scons2.3.0;
(3) 安装python 和 scons, 将C:\Python27\Scripts写入PATH;
(4) 下载安装pywin32 ,安装

2、安装boost库(1.49版本).

解压后双击bootstrap.bat,生成bjam.exe后,cd到目录c:\boost下,(将boost_1_49更名为boost了)编译boost。

编译命令:C:\boost>bjam variant=release --with-filesystem --with-thread --with-date_time --with-program_options --with-regex  threading=multi
toolset=msvc-11.0  address-model=32 --build-type=complete stage

编译命令:c:\boost>bjam --with-filesystem --with-thread --with-date_time --with-program_options --with-regex
toolset=msvc-11.0  address-model=32 link=shared  threading=multi  variant=debug  runtime-link=shared  stage

编译命令:c:\boost>bjam --with-filesystem
--with-thread --with-date_time --with-program_options --with-regex toolset=msvc-11.0  address-model=32 link=static  threading=multi  variant=debug runtime-link=shared  stage

创建目录 d:\mongo_drive\boost_lib, 把 c:\boost\stage\lib 目录下的所有
lib 文件拷贝过去.

3、编译mongodb.

下载mongo-cxx-driver-legacy,地址:https://github.com/mongodb/mongo-cxx-driver/releases,解压到
D:\mongo_drive 下
在 CMD 窗口中, 进入目录 D:\mongo_drive\mongo-cxx-driver-legacy, 然后执行下面的命令.

release
:scons --32 --sharedclient --dynamic-windows --prefix="d:\mongo_drive" --cpppath="c:\boost" --libpath="d:\mongo_drive\boost_lib" install

debug : scons --32 --sharedclient --dynamic-windows --prefix="d:\mongo_drive" --cpppath="c:\boost" --libpath="d:\mongo_drive\boost_lib"  install --dbg=on

d:\mongo_drive
下生成了两个文件夹 lib 和 include,就是 mongodb C++ 驱动
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mongodb vs2012 boost