I want to develop a fairly simple application using c++ for mongoDB and I follow their tutorials : http://www.mongodb.org/pages/viewpage.action?pageId=133415
and for installing driver I followed this one : https://groups.google.com/forum/?fromgroups=#!msg/mongodb-user/-mPG7MDJgm8/nZSiN42DJWIJ (Waitman Gobble/5 jun answer)
but yet when I try to compile a simple application I will get following error :
fatal error: client/dbclient.h: No such file or directory
I'm pretty sure the problem is MongoDB c++ driver hasn't installed yet.
How can I install it properly?
If you download the driver source code from here,
Unpack and unzip
Then cd into the directory.
Then use scons to build
and install
Then to compile code shown in the tutorial you need to also specify the /usr/local/include/mongo directory as a include file search path.
Then to run it you will need to edit the /etc/ld.so.conf file
and add
Then run
and run the tutorial
As an alternative to editing the ld.so.config file you can use the LD_LIBRARY_PATH environment variable. So you would do
In Ubuntu packages for development are separate from packages for general use.
In order to make use of the mongodb header files and clientlibraries, you need to
sudo apt-get install mongodb-dev libmongo-client-dev
- this adds the headers that will allow you to#include
the relevant header files.This assumes that you've already installed the
libmongo-client
andmongodb
packages, which contains the client library, although they should be installed when you install the-dev
packages.