2016-4-6 14:17:15Preparation before installation:
1/install Boost library
2/Install SCons program
Method One:
$ git clone git://github.com/mongodb/mongo.git
$ CD MONGO
$ cat Docs/building.md
$ scons.
After a period of compilation, the server side and client of MongoDB can be generated, as well as the C + + client library.
Method two: Compile with scons (to install the SCons program first)
Download MONGO source (http://www.mongodb.org/downloads) from official website, the version i downloaded is
Mongodb-src-r2.0.7.tar.gz
Generate mongodb-src-r2.0.7 directory after decompression, CD to this directory
Then execute the command:
SCons--prefix=/urs/local/mongo
By then, three directories will be generated in/urs/local/mongo bin,include,lib where: Bin contains MONGO server and client, and some other tools include MONGO's header file Lib is the client's library. The generated CPP client library is complete! In the source directory, client/example under a few simple test samples, you can compile: CD to client/example under the compiler first.cpp g++ first.cpp-o first-i/usr/local/mongo/ Include/mongo-l/usr/local/mongo/lib-llibmongoclient.a-lboost_thread-lboost_filesystem-lboost_program_options- Lboost_system compiling clientTest.cpp g++ clienttest.cpp-o clienttest-i/usr/local/mongo/include/mongo-l/usr/local/mongo/ Lib-llibmongoclient.a-lboost_thread-lboost_filesystem-lboost_program_options-lboost_system
Note:compile commands in the link order of the library to be careful, will affect the success of the compilation!!!
Linux under the MongoDB program and C + + client compilation