mongodb c++ driver- error: “mongo::client” has not been declared -
i got error when trying test example after installing mongodb , boost , mongodb-cxx driver (the example use c++ driver mongodb)
the version of driver trying build (branch or tag).
legacy
git clone https://github.com/mongodb/mongo-cxx-driver.git git checkout legacy
host os, version, , architecture.
raspbian wheezy : linux version 3.18.14-v7+ (root@vagrant-ubuntu-trusty-32) (gcc version 4.8.3 20140106 (prerelease) (crosstool-ng linaro-1.13.1-4.8-2014.01 - linaro gcc 2013.11) )
c++ compiler , version.
g++/gcc (debian 4.6.3-14+rpi1) 4.6.3
boost version.
examples: boost 1.58.0
how boost built or installed. http://www.boost.org/doc/libs/1_55_0/doc/html/bbv2/installation.html
./bootstrap.sh ./b2 install --prefix=prefix
the complete scons invocation.
scons
i haven't done configure ...
i trying run file
g++ -i/opt/mongo/include/ -i/opt/mongo/include/mongo -i/home/pi/boost_1_58_0/prefix/include -l/home/pi/boost_1_58_0/prefix/lib -l/opt/mongo/lib/ tutorial.cpp -pthread -lmongoclient -lboost_thread-mt -lboost_system -lboost_regex -lboost_filesystem -lboost_program_options -lboost_system -o tutorial
-file tutorial.cpp
#include <cstdlib> #include <iostream> #include "/opt/mongo/include/mongo/client/dbclient.h" // driver void run() { mongo::dbclientconnection c; c.connect("localhost"); } int main() { mongo::client::initialize(); try { run(); std::cout << "connected ok" << std::endl; } catch( const mongo::dbexception &e ) { std::cout << "caught " << e.what() << std::endl; } return exit_success; }
results - error:
tutorial.cpp: in function ‘int main()’: tutorial.cpp:12:12: error: ‘mongo::client’ has not been declared
any hint please , ?
Comments
Post a Comment