Linux under the MongoDB program and C + + client compilation

Source: Internet
Author: User
Tags git clone

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

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.