MONGO C + + Driver 2.0 compilation uses

Source: Internet
Author: User

Installing boost1.48.0

Download boost1.48.0 on the Boost website at the following link:

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 directory

CD boost_1_48_0 into the Boost library directory

./bootstrap.sh generating Bjam executables in the current directory

./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, link below:

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 extract to current directory

CD scons-2.1.0 into the SCons directory

Python setup.py install default installation scons


Installing pcre-8.21

Download the pcre-8.21 on Pcre's website, link below:

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 directory

CD pcre-8.21 into the Pcre directory

./configure Generate Makefile

Make

Make install default installation Pcre


Compile Build Libmongoclient.a

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

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

Download one of the cxx-driver/mongodb-linux-x86_64-v2.0-latest.tgz

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

CD mongo-cxx-driver-v2.0 into MONGO C + + driver directory

SCons Generating LIBMONGOCLIENT.A Libraries


Note: The following error message is generated in the process, no relationship, the LIBMONGOCLIENT.A library has been generated in the MONGO C + + driver directory

After the LIBMONGOCLIENT.A library MONGO folder is copied out, the MONGO folder under the non-. h file is removed, so we get the MONGO C + + driver Library and header file


Using MONGO C + + driver

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

The g++ compiler directive is as follows:

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

MONGO C + + Driver 2.0 compilation uses

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.