Hey guys, I got the mongoshell and Json file all set up. I need help connecting Mongodb to C++
I typed this in the command prompt but it gave a a syntax error. (my file name is ConnectorMain.cpp)
-I/usr/local/include -L/usr/local/lib -pthread -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_program_options -lboost_system app/ConnectorMain.cpp -o ConnectorMain
This person had the same problem: http://stackoverflow.com/questions/17757683/mongo-c-driver-mongo-client-dbclient-h-no-such-file-or-directory
The reason that there you need to type this in the cmd pmt is because it will allow you to access the weird #inclue files like:
#include "mongo/client/dbclient.h"
I've visited http://api.mongodb.org/cplusplus/current/files.html
and this is the dbclient.h file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#pragma once
#ifdef MONGO_EXPOSE_MACROS
#error dbclient.h is for C++ driver consumer use only
#endif
#define LIBMONGOCLIENT_CONSUMER
#include "mongo/client/redef_macros.h"
#include "mongo/pch.h"
#include "mongo/client/connpool.h"
#include "mongo/client/dbclient_rs.h"
#include "mongo/client/dbclientcursor.h"
#include "mongo/client/dbclientinterface.h"
#include "mongo/client/gridfs.h"
#include "mongo/client/init.h"
#include "mongo/client/sasl_client_authenticate.h"
#include "mongo/client/syncclusterconnection.h"
#include "mongo/util/net/ssl_options.h"
#include "mongo/client/undef_macros.h"
|
and it is crazy cause of all the headers so I am trying to figure out how to hook this all up and as the forum says it has to do with setting up a -I or -L because it relates to this forum http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-cpp-driver/#installing-the-driver-library-and-headers but that is in Linux.
Please help if you know how to do this.