"Code execution cannot proceed because snappy.dll not found". while running Mongodb CXX attached project using VS 2015

Hi All,

I have installed Mongo c driver and cxx drivers successfully. Then I create the VS2015 project and link the c driver and c++ drivers

Added below code

#include "bsoncxx\json.hpp"
#include "mongocxx\client.hpp"
#include "mongocxx\stdx.hpp"
#include "mongocxx\uri.hpp"
#include "mongocxx\instance.hpp"
#include "bsoncxx\builder\basic\helpers.hpp"
#include "bsoncxx\builder\basic\document.hpp"
#include "bsoncxx\builder\basic\array.hpp" 

int main()
{
	mongocxx::instance instance{};
	mongocxx::client client{ mongocxx::uri{ } };// Equivalant mongocxx::uri uri("mongodb://localhost:27017");
	mongocxx::database db = client["school"];
	mongocxx::collection coll = db["student"];

	mongocxx::cursor cursor = coll.find({});

	for (auto doc : cursor) {
		std::cout << bsoncxx::to_json(doc) << "\n";
	}

    return 0;
}
  • It is successfully building but during running it shows error message “Code execution cannot proceed
    because snappy.dll not found”.
  1. To set up the c driver I follow below steps
    http://mongoc.org/libmongoc/current/installing.html
    • Download Drivers
    • mkdir cmake-build64
    • cd cmake-build64
    • cmake -G “Visual Studio 14 2015 Win64” “-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver” “-DCMAKE_PREFIX_PATH=C:\mongo-c-driver” C:\1project\TestJobs_Rework\mongo-c-driver-1.17.3.tar\mongo-c-driver-1.17.3 C:\1project\TestJobs_Rework\mongo-c-driver-1.17.3.tar\mongo-c-driver-1.17.3\cmake-build64
    cmake --build . --config Release --target install