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