windows下编译MongoDB2.41 C++ Drive

Step 1(第一步): Compile Environment(建立编译环境)

0. Download MongoDB Src 2.4.1 

Extract it.

  1. Install Python: http://www.python.org/download/releases/2.7.2/.

    Make sure to install the 32-bit version of python and not the 64-bit as the SCons binaries below are 32-bit.

  2. It is recommended you install pywin32 if you want to do parallel builds (scons -j): http://sourceforge.net/projects/pywin32/
  3. Install SCons:

    http://sourceforge.net/projects/scons/

  4. Add the python scripts directory (e.g., C:\Python27\Scripts) to your PATH.
  5. Install Boost 1.4.9,compile (注:MongoDB V2暂时只支持1.4.9)
   bootstrap
   .\b2

You will get some libs in “**\boost\stage\lib”(库文件在stage\lib目录下)


Step 2(第二步):Build with SCons

scons --dd --32 mongoclient.lib  // build C++ client driver library
                                 // Debug, 32bit, C++ Driver

You will get mongoclient.lib in  ”**\mongodb-src-r2.4.1\build\win32\32\dd\client_build”

And some .h,.cpp files will generated in “**\mongodb-src-r2.4.1\build\win32\32\dd\mongo”

hose files will be added in sample project’s path in VS 2010.

(用Scons编译Debug 32版本的mongoclient.lib,同时会生成几个头文件,这些文件在编译例子的时候需要添加到包含文件的路径中,如果编译release版本,修改–dd为–release)


Step 3(第三步):编译例程 client/examples/simple_client_demo.vcxproj

1. Open Project(打开工程)

2. Add include directoroies(添加包含文件的路径)(boost,mongodb,mongodbClinet)

3. Add lib directories(mongodbclient.lib)

4. Compile with /MT

  • Include the WinSock library in your application: Linker ‣ Input ‣ Additional Dependencies - add ws2_32.lib.

5. Run it

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值