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