MongoDB C + + Driver 2.0 compiled using

Source: Internet
Author: User

Installing boost1.48.0

Download boost1.48.0 on the Boost website, links such as the following:

Http://sourceforge.net/projects/boost/files/boost/1.48.0/boost_1_48_0.tar.gz/download

TAR-XZVF boost_1_48_0.tar.gz extract to current folder

CD boost_1_48_0 into the Boost library folder

./bootstrap.sh generate Bjam in the current folder to run the program

./bjam--layout=versioned--build-type=complete--toolset=gcc install boost library

./bjam Install

Export Ld_library_path=/usr/local/lib Set Library load path


Installing scons-2.1.0

Download the scons-2.1.0 on SCons's website, such as the following:

Http://sourceforge.net/projects/scons/files/scons/2.1.0/scons-2.1.0.tar.gz/download

TAR–XZVF scons-2.1.0.tar.gz Unzip to the current folder

CD scons-2.1.0 into the SCons folder

Python setup.py install default installation scons


Installing pcre-8.21

Download the pcre-8.21 on Pcre's website, such as the following:

Http://sourceforge.net/projects/pcre/files/pcre/8.21/pcre-8.21.tar.gz/download

TAR–XZVF pcre-8.21.tar.gz extract to current folder

CD pcre-8.21 into the Pcre folder

./configure Generate Makefile

Make

Make install default installation Pcre


Compile Build Libmongoclient.a

Download the latest C + + driver on the MongoDB website, links such as the following:

http://dl.mongodb.org/dl/cxx-driver/

Download the Cxx-driver/mongodb-linux-x86_64-v2.0-latest.tgz

TAR–XZVF mongodb-linux-x86_64-v2.0-latest.tgz extract to current folder

CD mongo-cxx-driver-v2.0 into the MongoDB C + + Driver folder

SCons Generating LIBMONGOCLIENT.A Libraries


Note: Error messages such as the following are generated during the process. No relationship, the LIBMONGOCLIENT.A library has been generated in the MongoDB C + + Driver folder

After the LIBMONGOCLIENT.A library MONGO directory is copied out, the MONGO directory of the following non-. h files is removed, so we have the MongoDB C + + driver Library and header files


Using MongoDB C + + driver

Add the resulting library and header files to your project and you can use them.

g++ compile directives such as the following:

g++-o demo demo.cpp–l/usr/local/lib libmongoclient.a-lboost_thread-lboost_filesystem-lboost_program_options

MongoDB C + + Driver 2.0 compiled using

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.